diff --git a/azure-pipelines.yml b/azure-pipelines.yml
new file mode 100644
index 00000000..9ec8ebba
--- /dev/null
+++ b/azure-pipelines.yml
@@ -0,0 +1,88 @@
+# ASP.NET Core (.NET Framework)
+# Build and test ASP.NET Core projects targeting the full .NET Framework.
+# Add steps that publish symbols, save build artifacts, and more:
+# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
+
+schedules:
+- cron: "0 */6 * * *"
+ displayName: Daily midnight build
+ branches:
+ include:
+ - master
+ always: true
+
+trigger:
+- master
+
+pool:
+ vmImage: 'ubuntu-latest'
+
+variables:
+ solution: '**/*.sln'
+ buildPlatform: 'Any CPU'
+ buildConfiguration: 'Release'
+
+steps:
+- task: UseDotNet@2
+ inputs:
+ packageType: 'sdk'
+ version: '3.x'
+- task: CmdLine@2
+ displayName: 'install dotnet-ef'
+ inputs:
+ script: 'dotnet tool install -g dotnet-ef'
+
+- task: CmdLine@2
+ inputs:
+ script: |
+ echo commands
+ sed -i '0,/Default[^,]*/s//$(ConnectionStrings)"/g' samples/EShopSample/aspnet-core/src/EShopSample.Web/appsettings.json
+ echo commands executed
+- task: CmdLine@2
+ inputs:
+ script: |
+ echo commands
+ sed -i '0,/Default[^,]*/s//$(ConnectionStrings)"/g' samples/EShopSample/aspnet-core/src/EShopSample.DbMigrator/appsettings.json
+ echo commands executed
+- task: DotNetCoreCLI@2
+ displayName: 'restore'
+ inputs:
+ command: 'restore'
+ feedsToUse: 'select'
+
+- task: DotNetCoreCLI@2
+ displayName: 'build'
+ inputs:
+ command: 'build'
+
+- task: CmdLine@2
+ displayName: 'publish'
+ inputs:
+ script: |
+ dotnet publish
+- task: CmdLine@2
+ displayName: 'drop database'
+ inputs:
+ script: |
+ dotnet ef database drop --project samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/EShopSample.EntityFrameworkCore.DbMigrations.csproj -s samples/EShopSample/aspnet-core/src/EShopSample.Web/EShopSample.Web.csproj -f
+
+- task: CmdLine@2
+ displayName: 'update database'
+ inputs:
+ script: |
+ dotnet ef database update --project samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/EShopSample.EntityFrameworkCore.DbMigrations.csproj -s samples/EShopSample/aspnet-core/src/EShopSample.Web/EShopSample.Web.csproj
+- task: CmdLine@2
+ inputs:
+ script: |
+ cd samples/EShopSample/aspnet-core/src/EShopSample.DbMigrator
+
+ dotnet run
+- task: Docker@2
+ displayName: 'build and push docker'
+ inputs:
+ containerRegistry: $(DockerRegistry)
+ repository: $(repository)
+ command: 'buildAndPush'
+ Dockerfile: 'samples/EShopSample/aspnet-core/src/EShopSample.Web/Dockerfile'
+ buildContext: .
+ tags: 'latest'
diff --git a/common.props b/common.props
index fe37649f..00da413f 100644
--- a/common.props
+++ b/common.props
@@ -1,7 +1,7 @@
latest
- 0.10.0
+ 0.12.0
$(NoWarn);CS1591
true
EasyAbp Team
diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp.EShop.Orders.Domain.csproj b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp.EShop.Orders.Domain.csproj
index 9d5e4278..cea78d32 100644
--- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp.EShop.Orders.Domain.csproj
+++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp.EShop.Orders.Domain.csproj
@@ -8,7 +8,6 @@
-
diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/EShopOrdersDomainModule.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/EShopOrdersDomainModule.cs
index e1ef593c..97caaf32 100644
--- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/EShopOrdersDomainModule.cs
+++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/EShopOrdersDomainModule.cs
@@ -1,4 +1,6 @@
using EasyAbp.EShop.Orders.Orders;
+using EasyAbp.EShop.Payments;
+using EasyAbp.EShop.Products;
using EasyAbp.EShop.Stores;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AutoMapper;
@@ -10,6 +12,8 @@ namespace EasyAbp.EShop.Orders
{
[DependsOn(
typeof(AbpAutoMapperModule),
+ typeof(EShopPaymentsDomainSharedModule),
+ typeof(EShopProductsDomainSharedModule),
typeof(EShopOrdersDomainSharedModule)
)]
public class EShopOrdersDomainModule : AbpModule
diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/BasicCompletableCheckProvider.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/BasicOrderCompletableCheckProvider.cs
similarity index 80%
rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/BasicCompletableCheckProvider.cs
rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/BasicOrderCompletableCheckProvider.cs
index 11337db6..9fbc3d25 100644
--- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/BasicCompletableCheckProvider.cs
+++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/BasicOrderCompletableCheckProvider.cs
@@ -3,7 +3,7 @@ using Volo.Abp.DependencyInjection;
namespace EasyAbp.EShop.Orders.Orders
{
- public class BasicCompletableCheckProvider : ICompletableCheckProvider, ITransientDependency
+ public class BasicOrderCompletableCheckProvider : IOrderCompletableCheckProvider, ITransientDependency
{
public virtual Task CheckAsync(Order order)
{
diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/ICompletableCheckProvider.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderCompletableCheckProvider.cs
similarity index 70%
rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/ICompletableCheckProvider.cs
rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderCompletableCheckProvider.cs
index df215e15..b130b1bf 100644
--- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/ICompletableCheckProvider.cs
+++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderCompletableCheckProvider.cs
@@ -2,7 +2,7 @@
namespace EasyAbp.EShop.Orders.Orders
{
- public interface ICompletableCheckProvider
+ public interface IOrderCompletableCheckProvider
{
Task CheckAsync(Order order);
}
diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderPaymentChecker.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderPaymentChecker.cs
index 6a8ed084..3a3bb8a0 100644
--- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderPaymentChecker.cs
+++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderPaymentChecker.cs
@@ -1,10 +1,10 @@
using System.Threading.Tasks;
-using EasyAbp.PaymentService.Payments;
+using EasyAbp.EShop.Payments.Payments;
namespace EasyAbp.EShop.Orders.Orders
{
public interface IOrderPaymentChecker
{
- Task IsValidPaymentAsync(Order order, PaymentEto payment, PaymentItemEto paymentItem);
+ Task IsValidPaymentAsync(Order order, EShopPaymentEto payment, EShopPaymentItemEto paymentItem);
}
}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderPaymentCompletedEventHandler.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderPaymentCompletedEventHandler.cs
deleted file mode 100644
index 7d51d667..00000000
--- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderPaymentCompletedEventHandler.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using EasyAbp.PaymentService.Payments;
-using Volo.Abp.Domain.Entities.Events.Distributed;
-using Volo.Abp.EventBus.Distributed;
-
-namespace EasyAbp.EShop.Orders.Orders
-{
- public interface IOrderPaymentCompletedEventHandler : IDistributedEventHandler
- {
-
- }
-}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderPaymentCreatedEventHandler.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderPaymentCreatedEventHandler.cs
deleted file mode 100644
index c15f8b9f..00000000
--- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderPaymentCreatedEventHandler.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using EasyAbp.PaymentService.Payments;
-using Volo.Abp.Domain.Entities.Events.Distributed;
-using Volo.Abp.EventBus.Distributed;
-
-namespace EasyAbp.EShop.Orders.Orders
-{
- public interface IOrderPaymentCreatedEventHandler : IDistributedEventHandler>
- {
-
- }
-}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IPaymentCompletedEventHandler.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IPaymentCompletedEventHandler.cs
new file mode 100644
index 00000000..2b98e44b
--- /dev/null
+++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IPaymentCompletedEventHandler.cs
@@ -0,0 +1,10 @@
+using EasyAbp.EShop.Payments.Payments;
+using Volo.Abp.EventBus.Distributed;
+
+namespace EasyAbp.EShop.Orders.Orders
+{
+ public interface IPaymentCompletedEventHandler : IDistributedEventHandler
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IPaymentCreatedEventHandler.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IPaymentCreatedEventHandler.cs
new file mode 100644
index 00000000..99256240
--- /dev/null
+++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IPaymentCreatedEventHandler.cs
@@ -0,0 +1,11 @@
+using EasyAbp.EShop.Payments.Payments;
+using Volo.Abp.Domain.Entities.Events.Distributed;
+using Volo.Abp.EventBus.Distributed;
+
+namespace EasyAbp.EShop.Orders.Orders
+{
+ public interface IPaymentCreatedEventHandler : IDistributedEventHandler>
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderProductInventoryReductionEventHandler.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IProductInventoryReductionEventHandler.cs
similarity index 82%
rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderProductInventoryReductionEventHandler.cs
rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IProductInventoryReductionEventHandler.cs
index 72c2368e..fb4f2829 100644
--- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderProductInventoryReductionEventHandler.cs
+++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IProductInventoryReductionEventHandler.cs
@@ -3,7 +3,7 @@ using Volo.Abp.EventBus.Distributed;
namespace EasyAbp.EShop.Orders.Orders
{
- public interface IOrderProductInventoryReductionEventHandler :
+ public interface IProductInventoryReductionEventHandler :
IDistributedEventHandler,
IDistributedEventHandler
{
diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderPaymentInvalidException.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidPaymentException.cs
similarity index 60%
rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderPaymentInvalidException.cs
rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidPaymentException.cs
index 9f82003a..923db2fd 100644
--- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderPaymentInvalidException.cs
+++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidPaymentException.cs
@@ -3,9 +3,9 @@ using Volo.Abp;
namespace EasyAbp.EShop.Orders.Orders
{
- public class OrderPaymentInvalidException : BusinessException
+ public class InvalidPaymentException : BusinessException
{
- public OrderPaymentInvalidException(Guid paymentId, Guid orderId)
+ public InvalidPaymentException(Guid paymentId, Guid orderId)
: base(message: $"The payment {paymentId} has invalid configurations for the order {orderId}.")
{
}
diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderLine.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderLine.cs
index a7736486..4a91c711 100644
--- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderLine.cs
+++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderLine.cs
@@ -89,7 +89,7 @@ namespace EasyAbp.EShop.Orders.Orders
internal void Refund(int quantity, decimal amount)
{
- RefundedQuantity -= quantity;
+ RefundedQuantity += quantity;
RefundAmount += amount;
}
}
diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderManager.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderManager.cs
index c4d53ce7..fae3139a 100644
--- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderManager.cs
+++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderManager.cs
@@ -36,7 +36,7 @@ namespace EasyAbp.EShop.Orders.Orders
throw new OrderIsInWrongStageException(order.Id);
}
- var providers = ServiceProvider.GetServices();
+ var providers = ServiceProvider.GetServices();
foreach (var provider in providers)
{
diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderPaymentChecker.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderPaymentChecker.cs
index 830f4021..7b4a18b1 100644
--- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderPaymentChecker.cs
+++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderPaymentChecker.cs
@@ -1,6 +1,6 @@
using System;
using System.Threading.Tasks;
-using EasyAbp.PaymentService.Payments;
+using EasyAbp.EShop.Payments.Payments;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
@@ -8,26 +8,26 @@ namespace EasyAbp.EShop.Orders.Orders
{
public class OrderPaymentChecker : IOrderPaymentChecker, ITransientDependency
{
- public virtual async Task IsValidPaymentAsync(Order order, PaymentEto payment, PaymentItemEto paymentItem)
+ public virtual async Task IsValidPaymentAsync(Order order, EShopPaymentEto payment, EShopPaymentItemEto paymentItem)
{
return await IsStoreIdCorrectAsync(order, paymentItem) &&
await IsPaymentPriceCorrectAsync(order, paymentItem) &&
await IsUserAllowedToPayAsync(order, payment);
}
- protected virtual Task IsStoreIdCorrectAsync(Order order, PaymentItemEto paymentItem)
+ protected virtual Task IsStoreIdCorrectAsync(Order order, EShopPaymentItemEto paymentItem)
{
return Task.FromResult(
Guid.TryParse(paymentItem.GetProperty("StoreId"), out var paymentStoreId) &&
order.StoreId == paymentStoreId);
}
- protected virtual Task IsPaymentPriceCorrectAsync(Order order, PaymentItemEto paymentItem)
+ protected virtual Task IsPaymentPriceCorrectAsync(Order order, EShopPaymentItemEto paymentItem)
{
return Task.FromResult(order.TotalPrice == paymentItem.OriginalPaymentAmount);
}
- protected virtual Task IsUserAllowedToPayAsync(Order order, PaymentEto payment)
+ protected virtual Task IsUserAllowedToPayAsync(Order order, EShopPaymentEto payment)
{
return Task.FromResult(order.CustomerUserId == payment.UserId);
}
diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/PaymentCanceledEventHandler.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/PaymentCanceledEventHandler.cs
new file mode 100644
index 00000000..c7963b14
--- /dev/null
+++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/PaymentCanceledEventHandler.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Linq;
+using System.Threading.Tasks;
+using EasyAbp.EShop.Payments;
+using EasyAbp.EShop.Payments.Payments;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.EventBus.Distributed;
+using Volo.Abp.Uow;
+
+namespace EasyAbp.EShop.Orders.Orders
+{
+ public class PaymentCanceledEventHandler : IDistributedEventHandler, ITransientDependency
+ {
+ private readonly IOrderRepository _orderRepository;
+
+ public PaymentCanceledEventHandler(IOrderRepository orderRepository)
+ {
+ _orderRepository = orderRepository;
+ }
+
+ [UnitOfWork(true)]
+ public virtual async Task HandleEventAsync(EShopPaymentCanceledEto eventData)
+ {
+ foreach (var paymentItem in eventData.Payment.PaymentItems.Where(item =>
+ item.ItemType == PaymentsConsts.PaymentItemType))
+ {
+ var order = await _orderRepository.GetAsync(Guid.Parse(paymentItem.ItemKey));
+
+ order.SetPaymentId(null);
+
+ await _orderRepository.UpdateAsync(order, true);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderPaymentCompletedEventHandler.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/PaymentCompletedEventHandler.cs
similarity index 81%
rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderPaymentCompletedEventHandler.cs
rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/PaymentCompletedEventHandler.cs
index dbc59fff..35273131 100644
--- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderPaymentCompletedEventHandler.cs
+++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/PaymentCompletedEventHandler.cs
@@ -2,9 +2,8 @@
using System.Linq;
using System.Threading.Tasks;
using EasyAbp.EShop.Payments;
-using EasyAbp.PaymentService.Payments;
+using EasyAbp.EShop.Payments.Payments;
using Volo.Abp.DependencyInjection;
-using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.MultiTenancy;
using Volo.Abp.ObjectMapping;
@@ -13,7 +12,7 @@ using Volo.Abp.Uow;
namespace EasyAbp.EShop.Orders.Orders
{
- public class OrderPaymentCompletedEventHandler : IOrderPaymentCompletedEventHandler, ITransientDependency
+ public class PaymentCompletedEventHandler : IPaymentCompletedEventHandler, ITransientDependency
{
private readonly IClock _clock;
private readonly ICurrentTenant _currentTenant;
@@ -23,7 +22,7 @@ namespace EasyAbp.EShop.Orders.Orders
private readonly IDistributedEventBus _distributedEventBus;
private readonly IOrderRepository _orderRepository;
- public OrderPaymentCompletedEventHandler(
+ public PaymentCompletedEventHandler(
IClock clock,
ICurrentTenant currentTenant,
IObjectMapper objectMapper,
@@ -41,7 +40,8 @@ namespace EasyAbp.EShop.Orders.Orders
_orderRepository = orderRepository;
}
- public virtual async Task HandleEventAsync(PaymentCompletedEto eventData)
+ [UnitOfWork(true)]
+ public virtual async Task HandleEventAsync(EShopPaymentCompletedEto eventData)
{
var payment = eventData.Payment;
@@ -52,8 +52,6 @@ namespace EasyAbp.EShop.Orders.Orders
using var currentTenant = _currentTenant.Change(payment.TenantId);
- using var uow = _unitOfWorkManager.Begin(isTransactional: true);
-
foreach (var item in payment.PaymentItems.Where(item => item.ItemType == PaymentsConsts.PaymentItemType))
{
var orderId = Guid.Parse(item.ItemKey);
@@ -68,7 +66,7 @@ namespace EasyAbp.EShop.Orders.Orders
if (!await _orderPaymentChecker.IsValidPaymentAsync(order, payment, item))
{
- throw new OrderPaymentInvalidException(payment.Id, orderId);
+ throw new InvalidPaymentException(payment.Id, orderId);
}
order.SetPaidTime(_clock.Now);
@@ -76,7 +74,7 @@ namespace EasyAbp.EShop.Orders.Orders
await _orderRepository.UpdateAsync(order, true);
- uow.OnCompleted(async () => await _distributedEventBus.PublishAsync(new OrderPaidEto
+ _unitOfWorkManager.Current.OnCompleted(async () => await _distributedEventBus.PublishAsync(new OrderPaidEto
{
Order = _objectMapper.Map(order),
PaymentId = payment.Id,
@@ -84,7 +82,7 @@ namespace EasyAbp.EShop.Orders.Orders
}));
}
- await uow.CompleteAsync();
+ await _unitOfWorkManager.Current.CompleteAsync();
}
}
}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderPaymentCreatedEventHandler.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/PaymentCreatedEventHandler.cs
similarity index 85%
rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderPaymentCreatedEventHandler.cs
rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/PaymentCreatedEventHandler.cs
index e621536c..ac62af33 100644
--- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderPaymentCreatedEventHandler.cs
+++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/PaymentCreatedEventHandler.cs
@@ -2,7 +2,7 @@
using System.Linq;
using System.Threading.Tasks;
using EasyAbp.EShop.Payments;
-using EasyAbp.PaymentService.Payments;
+using EasyAbp.EShop.Payments.Payments;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.MultiTenancy;
@@ -10,13 +10,13 @@ using Volo.Abp.Uow;
namespace EasyAbp.EShop.Orders.Orders
{
- public class OrderPaymentCreatedEventHandler : IOrderPaymentCreatedEventHandler, ITransientDependency
+ public class PaymentCreatedEventHandler : IPaymentCreatedEventHandler, ITransientDependency
{
private readonly ICurrentTenant _currentTenant;
private readonly IOrderPaymentChecker _orderPaymentChecker;
private readonly IOrderRepository _orderRepository;
- public OrderPaymentCreatedEventHandler(
+ public PaymentCreatedEventHandler(
ICurrentTenant currentTenant,
IOrderPaymentChecker orderPaymentChecker,
IOrderRepository orderRepository)
@@ -27,7 +27,7 @@ namespace EasyAbp.EShop.Orders.Orders
}
[UnitOfWork(true)]
- public virtual async Task HandleEventAsync(EntityCreatedEto eventData)
+ public virtual async Task HandleEventAsync(EntityCreatedEto eventData)
{
using var currentTenant = _currentTenant.Change(eventData.Entity.TenantId);
@@ -46,7 +46,7 @@ namespace EasyAbp.EShop.Orders.Orders
if (!await _orderPaymentChecker.IsValidPaymentAsync(order, eventData.Entity, item))
{
// Todo: should cancel the payment?
- throw new OrderPaymentInvalidException(eventData.Entity.Id, orderId);
+ throw new InvalidPaymentException(eventData.Entity.Id, orderId);
}
order.SetPaymentId(eventData.Entity.Id);
diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderProductInventoryReductionEventHandler.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/ProductInventoryReductionEventHandler.cs
similarity index 92%
rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderProductInventoryReductionEventHandler.cs
rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/ProductInventoryReductionEventHandler.cs
index 70e72dfb..35c07fe5 100644
--- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderProductInventoryReductionEventHandler.cs
+++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/ProductInventoryReductionEventHandler.cs
@@ -7,13 +7,13 @@ using Volo.Abp.Uow;
namespace EasyAbp.EShop.Orders.Orders
{
- public class OrderProductInventoryReductionEventHandler : IOrderProductInventoryReductionEventHandler, ITransientDependency
+ public class ProductInventoryReductionEventHandler : IProductInventoryReductionEventHandler, ITransientDependency
{
private readonly IClock _clock;
private readonly ICurrentTenant _currentTenant;
private readonly IOrderRepository _orderRepository;
- public OrderProductInventoryReductionEventHandler(
+ public ProductInventoryReductionEventHandler(
IClock clock,
ICurrentTenant currentTenant,
IOrderRepository orderRepository)
diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderRefundEventHandler.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/RefundCompletedEventHandler.cs
similarity index 57%
rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderRefundEventHandler.cs
rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/RefundCompletedEventHandler.cs
index 6f8e1735..2e29dcae 100644
--- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderRefundEventHandler.cs
+++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/RefundCompletedEventHandler.cs
@@ -3,23 +3,30 @@ using EasyAbp.EShop.Payments.Refunds;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.EventBus.Distributed;
+using Volo.Abp.MultiTenancy;
using Volo.Abp.Uow;
namespace EasyAbp.EShop.Orders.Orders
{
- public class OrderRefundEventHandler : IDistributedEventHandler>, ITransientDependency
+ public class RefundCompletedEventHandler : IDistributedEventHandler, ITransientDependency
{
+ private readonly ICurrentTenant _currentTenant;
private readonly IOrderRepository _orderRepository;
- public OrderRefundEventHandler(IOrderRepository orderRepository)
+ public RefundCompletedEventHandler(
+ ICurrentTenant currentTenant,
+ IOrderRepository orderRepository)
{
+ _currentTenant = currentTenant;
_orderRepository = orderRepository;
}
[UnitOfWork(true)]
- public virtual async Task HandleEventAsync(EntityCreatedEto eventData)
+ public virtual async Task HandleEventAsync(EShopRefundCompletedEto eventData)
{
- foreach (var refundItem in eventData.Entity.RefundItems)
+ using var changeTenant = _currentTenant.Change(eventData.Refund.TenantId);
+
+ foreach (var refundItem in eventData.Refund.RefundItems)
{
var order = await _orderRepository.GetAsync(refundItem.OrderId);
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp.EShop.Payments.Application.Contracts.csproj b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp.EShop.Payments.Application.Contracts.csproj
index e4d38acc..c1bc0a2b 100644
--- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp.EShop.Payments.Application.Contracts.csproj
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp.EShop.Payments.Application.Contracts.csproj
@@ -8,9 +8,9 @@
+
-
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/Dtos/PaymentDto.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/Dtos/PaymentDto.cs
index 6cedc0cd..3cce5d49 100644
--- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/Dtos/PaymentDto.cs
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/Dtos/PaymentDto.cs
@@ -7,6 +7,8 @@ namespace EasyAbp.EShop.Payments.Payments.Dtos
{
public class PaymentDto : ExtensibleFullAuditedEntityDto, IPayment
{
+ #region Base properties
+
public Guid UserId { get; set; }
public string PaymentMethod { get; set; }
@@ -30,7 +32,9 @@ namespace EasyAbp.EShop.Payments.Payments.Dtos
public DateTime? CompletionTime { get; set; }
public DateTime? CanceledTime { get; set; }
-
+
+ #endregion
+
public List PaymentItems { get; set; }
}
}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/Dtos/PaymentItemDto.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/Dtos/PaymentItemDto.cs
index 2e9cced2..b3646e71 100644
--- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/Dtos/PaymentItemDto.cs
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/Dtos/PaymentItemDto.cs
@@ -7,14 +7,12 @@ namespace EasyAbp.EShop.Payments.Payments.Dtos
{
public class PaymentItemDto : ExtensibleFullAuditedEntityDto, IPaymentItem
{
- public Guid StoreId { get; set; }
+ #region Base properties
public string ItemType { get; set; }
public string ItemKey { get; set; }
- public string Currency { get; set; }
-
public decimal OriginalPaymentAmount { get; set; }
public decimal PaymentDiscount { get; set; }
@@ -24,5 +22,9 @@ namespace EasyAbp.EShop.Payments.Payments.Dtos
public decimal RefundAmount { get; set; }
public decimal PendingRefundAmount { get; set; }
+
+ #endregion
+
+ public Guid StoreId { get; set; }
}
}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/OrderPaymentAlreadyExistsException.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/PaymentAlreadyExistsException.cs
similarity index 58%
rename from modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/OrderPaymentAlreadyExistsException.cs
rename to modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/PaymentAlreadyExistsException.cs
index 913c6735..6fbcf9ee 100644
--- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/OrderPaymentAlreadyExistsException.cs
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/PaymentAlreadyExistsException.cs
@@ -3,9 +3,9 @@ using Volo.Abp;
namespace EasyAbp.EShop.Payments.Payments
{
- public class OrderPaymentAlreadyExistsException : BusinessException
+ public class PaymentAlreadyExistsException : BusinessException
{
- public OrderPaymentAlreadyExistsException(Guid orderId)
+ public PaymentAlreadyExistsException(Guid orderId)
: base(message: $"The order {orderId}'s payment is already exists.")
{
}
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Refunds/Dtos/RefundDto.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Refunds/Dtos/RefundDto.cs
index 6aa8f9c1..9675f107 100644
--- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Refunds/Dtos/RefundDto.cs
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Refunds/Dtos/RefundDto.cs
@@ -7,6 +7,8 @@ namespace EasyAbp.EShop.Payments.Refunds.Dtos
{
public class RefundDto : FullAuditedEntityDto, IRefund
{
+ #region Base properties
+
public Guid PaymentId { get; set; }
public string RefundPaymentMethod { get; set; }
@@ -27,6 +29,8 @@ namespace EasyAbp.EShop.Payments.Refunds.Dtos
public DateTime? CanceledTime { get; set; }
+ #endregion
+
public List RefundItems { get; set; }
}
}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Refunds/Dtos/RefundItemDto.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Refunds/Dtos/RefundItemDto.cs
index 1972fd77..c833fb9b 100644
--- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Refunds/Dtos/RefundItemDto.cs
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Refunds/Dtos/RefundItemDto.cs
@@ -1,31 +1,28 @@
using System;
-using EasyAbp.PaymentService.Payments;
+using System.Collections.Generic;
using EasyAbp.PaymentService.Refunds;
using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Payments.Refunds.Dtos
{
- public class RefundItemDto : ExtensibleFullAuditedEntityDto, IRefund
+ public class RefundItemDto : ExtensibleFullAuditedEntityDto, IRefundItem
{
- public virtual Guid PaymentId { get; set; }
+ #region Base properties
- public virtual string RefundPaymentMethod { get; set; }
+ public Guid PaymentItemId { get; set; }
- public virtual string ExternalTradingCode { get; set; }
+ public decimal RefundAmount { get; set; }
- public virtual string Currency { get; set; }
-
- public virtual decimal RefundAmount { get; set; }
-
- public virtual string DisplayReason { get; set; }
-
- public virtual string CustomerRemark { get; set; }
-
- public virtual string StaffRemark { get; set; }
-
- public virtual DateTime? CompletedTime { get; set; }
-
- public virtual DateTime? CanceledTime { get; set; }
+ public string CustomerRemark { get; set; }
+ public string StaffRemark { get; set; }
+
+ #endregion
+
+ public Guid StoreId { get; set; }
+
+ public Guid OrderId { get; set; }
+
+ public List RefundItemOrderLines { get; set; }
}
}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Refunds/Dtos/RefundItemOrderLineDto.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Refunds/Dtos/RefundItemOrderLineDto.cs
new file mode 100644
index 00000000..27e24d93
--- /dev/null
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Refunds/Dtos/RefundItemOrderLineDto.cs
@@ -0,0 +1,14 @@
+using System;
+
+namespace EasyAbp.EShop.Payments.Refunds.Dtos
+{
+ [Serializable]
+ public class RefundItemOrderLineDto
+ {
+ public Guid OrderLineId { get; set; }
+
+ public int RefundedQuantity { get; set; }
+
+ public decimal RefundAmount { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/BasicPayableCheckProvider.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/BasicPayableCheckProvider.cs
index 8d3cf040..d0117f43 100644
--- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/BasicPayableCheckProvider.cs
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/BasicPayableCheckProvider.cs
@@ -14,7 +14,7 @@ namespace EasyAbp.EShop.Payments.Payments
{
foreach (var order in orders.Where(order => order.PaymentId.HasValue || order.PaidTime.HasValue))
{
- throw new OrderPaymentAlreadyExistsException(order.Id);
+ throw new PaymentAlreadyExistsException(order.Id);
}
if (orders.Select(order => order.Currency).Distinct().Count() != 1)
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/PaymentAppService.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/PaymentAppService.cs
index 49bddc95..9176fbc4 100644
--- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/PaymentAppService.cs
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/PaymentAppService.cs
@@ -101,7 +101,7 @@ namespace EasyAbp.EShop.Payments.Payments
ItemType = PaymentsConsts.PaymentItemType,
ItemKey = order.Id.ToString(),
OriginalPaymentAmount = order.TotalPrice,
- ExtraProperties = new Dictionary {{"StoreId", orders.First().StoreId.ToString()}}
+ ExtraProperties = new Dictionary {{"StoreId", order.StoreId.ToString()}}
}).ToList()
};
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/PaymentsApplicationAutoMapperProfile.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/PaymentsApplicationAutoMapperProfile.cs
index d9799048..7b54f6ca 100644
--- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/PaymentsApplicationAutoMapperProfile.cs
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/PaymentsApplicationAutoMapperProfile.cs
@@ -16,6 +16,8 @@ namespace EasyAbp.EShop.Payments
CreateMap();
CreateMap();
CreateMap();
+ CreateMap();
+ CreateMap();
}
}
}
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/OrderIsNotInSpecifiedPaymentException.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/OrderIsNotInSpecifiedPaymentException.cs
new file mode 100644
index 00000000..659c9974
--- /dev/null
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/OrderIsNotInSpecifiedPaymentException.cs
@@ -0,0 +1,13 @@
+using System;
+using Volo.Abp;
+
+namespace EasyAbp.EShop.Payments.Refunds
+{
+ public class OrderIsNotInSpecifiedPaymentException : BusinessException
+ {
+ public OrderIsNotInSpecifiedPaymentException(Guid orderId, Guid paymentId)
+ : base("OrderIsNotInSpecifiedPayment", $"The order ({orderId}) is not in the specified payment ({paymentId}).")
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/RefundAppService.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/RefundAppService.cs
index 88017628..6b63413e 100644
--- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/RefundAppService.cs
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/RefundAppService.cs
@@ -82,6 +82,8 @@ namespace EasyAbp.EShop.Payments.Refunds
public virtual async Task CreateAsync(CreateEShopRefundInput input)
{
await AuthorizationService.CheckAsync(PaymentsPermissions.Refunds.Manage);
+
+ var payment = await _paymentRepository.GetAsync(input.PaymentId);
var createRefundInput = new CreateRefundInput
{
@@ -95,6 +97,13 @@ namespace EasyAbp.EShop.Payments.Refunds
{
var order = await _orderAppService.GetAsync(refundItem.OrderId);
+ var paymentItem = payment.PaymentItems.SingleOrDefault(x => x.ItemKey == refundItem.OrderId.ToString());
+
+ if (order.PaymentId != input.PaymentId || paymentItem == null)
+ {
+ throw new OrderIsNotInSpecifiedPaymentException(order.Id, payment.Id);
+ }
+
// Todo: Check if current user is an admin of the store.
foreach (var orderLineRefundInfoModel in refundItem.OrderLines)
@@ -109,7 +118,7 @@ namespace EasyAbp.EShop.Payments.Refunds
createRefundInput.RefundItems.Add(new CreateRefundItemInput
{
- PaymentItemId = refundItem.OrderId,
+ PaymentItemId = paymentItem.Id,
RefundAmount = refundItem.OrderLines.Sum(x => x.TotalAmount),
CustomerRemark = refundItem.CustomerRemark,
StaffRemark = refundItem.StaffRemark,
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp.EShop.Payments.Domain.Shared.csproj b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp.EShop.Payments.Domain.Shared.csproj
index 500d0a51..dfa44ffa 100644
--- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp.EShop.Payments.Domain.Shared.csproj
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp.EShop.Payments.Domain.Shared.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Payments/EShopPaymentCanceledEto.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Payments/EShopPaymentCanceledEto.cs
new file mode 100644
index 00000000..cbd27968
--- /dev/null
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Payments/EShopPaymentCanceledEto.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace EasyAbp.EShop.Payments.Payments
+{
+ [Serializable]
+ public class EShopPaymentCanceledEto
+ {
+ public EShopPaymentEto Payment { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Payments/EShopPaymentCompletedEto.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Payments/EShopPaymentCompletedEto.cs
new file mode 100644
index 00000000..0f09a2af
--- /dev/null
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Payments/EShopPaymentCompletedEto.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace EasyAbp.EShop.Payments.Payments
+{
+ [Serializable]
+ public class EShopPaymentCompletedEto
+ {
+ public EShopPaymentEto Payment { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Payments/EShopPaymentEto.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Payments/EShopPaymentEto.cs
new file mode 100644
index 00000000..504f4499
--- /dev/null
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Payments/EShopPaymentEto.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using EasyAbp.PaymentService.Payments;
+using Volo.Abp.Data;
+using Volo.Abp.MultiTenancy;
+
+namespace EasyAbp.EShop.Payments.Payments
+{
+ [Serializable]
+ public class EShopPaymentEto : IPayment, IMultiTenant, IHasExtraProperties
+ {
+ #region Base properties
+
+ public Guid Id { get; set; }
+
+ public Guid? TenantId { get; set; }
+
+ public Guid UserId { get; set; }
+
+ public string PaymentMethod { get; set; }
+
+ public string PayeeAccount { get; set; }
+
+ public string ExternalTradingCode { get; set; }
+
+ public string Currency { get; set; }
+
+ public decimal OriginalPaymentAmount { get; set; }
+
+ public decimal PaymentDiscount { get; set; }
+
+ public decimal ActualPaymentAmount { get; set; }
+
+ public decimal RefundAmount { get; set; }
+
+ public decimal PendingRefundAmount { get; set; }
+
+ public DateTime? CompletionTime { get; set; }
+
+ public DateTime? CanceledTime { get; set; }
+
+ public Dictionary ExtraProperties { get; set; }
+
+ #endregion
+
+ public List PaymentItems { get; set; } = new List();
+ }
+}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Payments/EShopPaymentItemEto.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Payments/EShopPaymentItemEto.cs
new file mode 100644
index 00000000..bb72dd13
--- /dev/null
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Payments/EShopPaymentItemEto.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using EasyAbp.PaymentService.Payments;
+using Volo.Abp.Data;
+
+namespace EasyAbp.EShop.Payments.Payments
+{
+ [Serializable]
+ public class EShopPaymentItemEto : IPaymentItem, IHasExtraProperties
+ {
+ #region Base properties
+
+ public Guid Id { get; set; }
+
+ public string ItemType { get; set; }
+
+ public string ItemKey { get; set; }
+
+ public decimal OriginalPaymentAmount { get; set; }
+
+ public decimal PaymentDiscount { get; set; }
+
+ public decimal ActualPaymentAmount { get; set; }
+
+ public decimal RefundAmount { get; set; }
+
+ public decimal PendingRefundAmount { get; set; }
+
+ public Dictionary ExtraProperties { get; set; }
+
+ #endregion
+
+ public Guid StoreId { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Refunds/EShopRefundCompletedEto.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Refunds/EShopRefundCompletedEto.cs
new file mode 100644
index 00000000..1917f0f2
--- /dev/null
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Refunds/EShopRefundCompletedEto.cs
@@ -0,0 +1,7 @@
+namespace EasyAbp.EShop.Payments.Refunds
+{
+ public class EShopRefundCompletedEto
+ {
+ public EShopRefundEto Refund { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/EShopPaymentsDomainModule.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/EShopPaymentsDomainModule.cs
index b6115ab8..aae7a6ea 100644
--- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/EShopPaymentsDomainModule.cs
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/EShopPaymentsDomainModule.cs
@@ -1,8 +1,6 @@
using EasyAbp.EShop.Payments.Payments;
using EasyAbp.EShop.Payments.Refunds;
using EasyAbp.EShop.Stores;
-using EasyAbp.PaymentService.Payments;
-using EasyAbp.PaymentService.Refunds;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AutoMapper;
using Volo.Abp.Domain.Entities.Events.Distributed;
@@ -14,15 +12,17 @@ namespace EasyAbp.EShop.Payments
typeof(AbpAutoMapperModule),
typeof(EShopPaymentsDomainSharedModule),
typeof(EShopStoresDomainSharedModule)
- )]
+ )]
public class EShopPaymentsDomainModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
Configure(options =>
{
- options.EtoMappings.Add(typeof(EShopPaymentsDomainModule));
+ options.EtoMappings.Add(typeof(EShopPaymentsDomainModule));
+ options.EtoMappings.Add(typeof(EShopPaymentsDomainModule));
+ options.AutoEventSelectors.Add();
options.AutoEventSelectors.Add();
});
}
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Payments/PaymentItem.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Payments/PaymentItem.cs
index b270f85e..0fdadb94 100644
--- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Payments/PaymentItem.cs
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Payments/PaymentItem.cs
@@ -16,10 +16,7 @@ namespace EasyAbp.EShop.Payments.Payments
public virtual string ItemType { get; protected set; }
public virtual string ItemKey { get; protected set; }
-
- [NotNull]
- public virtual string Currency { get; protected set; }
-
+
public virtual decimal OriginalPaymentAmount { get; protected set; }
public virtual decimal PaymentDiscount { get; protected set; }
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Payments/PaymentSynchronizer.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Payments/PaymentSynchronizer.cs
index b766ffcc..3371ee38 100644
--- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Payments/PaymentSynchronizer.cs
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Payments/PaymentSynchronizer.cs
@@ -7,79 +7,167 @@ using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.EventBus.Distributed;
+using Volo.Abp.MultiTenancy;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Uow;
namespace EasyAbp.EShop.Payments.Payments
{
public class PaymentSynchronizer :
+ IDistributedEventHandler>,
IDistributedEventHandler>,
IDistributedEventHandler>,
IPaymentSynchronizer,
ITransientDependency
{
private readonly IObjectMapper _objectMapper;
+ private readonly ICurrentTenant _currentTenant;
+ private readonly IUnitOfWorkManager _unitOfWorkManager;
private readonly IPaymentRepository _paymentRepository;
+ private readonly IDistributedEventBus _distributedEventBus;
public PaymentSynchronizer(
IObjectMapper objectMapper,
- IPaymentRepository paymentRepository)
+ ICurrentTenant currentTenant,
+ IUnitOfWorkManager unitOfWorkManager,
+ IPaymentRepository paymentRepository,
+ IDistributedEventBus distributedEventBus)
{
_objectMapper = objectMapper;
+ _currentTenant = currentTenant;
+ _unitOfWorkManager = unitOfWorkManager;
_paymentRepository = paymentRepository;
+ _distributedEventBus = distributedEventBus;
}
[UnitOfWork(true)]
- public virtual async Task HandleEventAsync(EntityUpdatedEto eventData)
+ public virtual async Task HandleEventAsync(EntityCreatedEto eventData)
{
+ if (eventData.Entity.PaymentItems.All(item => item.ItemType != PaymentsConsts.PaymentItemType))
+ {
+ return;
+ }
+
+ using var changeTenant = _currentTenant.Change(eventData.Entity.TenantId);
+
var payment = await _paymentRepository.FindAsync(eventData.Entity.Id);
- if (payment == null)
+ if (payment != null)
{
- payment = _objectMapper.Map(eventData.Entity);
+ return;
+ }
+
+ payment = _objectMapper.Map(eventData.Entity);
+
+ payment.SetPaymentItems(
+ _objectMapper.Map, List>(eventData.Entity.PaymentItems));
+
+ payment.PaymentItems.ForEach(FillPaymentItemStoreId);
- payment.SetPaymentItems(
- _objectMapper.Map, List>(eventData.Entity.PaymentItems));
+ await _paymentRepository.InsertAsync(payment, true);
+
+ if (payment.CompletionTime.HasValue)
+ {
+ PublishPaymentCompletedEventOnUowCompleted(payment);
+ }
- await _paymentRepository.InsertAsync(payment, true);
+ if (payment.CanceledTime.HasValue)
+ {
+ PublishPaymentCanceledEventOnUowCompleted(payment);
}
- else
+ }
+
+ protected virtual void PublishPaymentCanceledEventOnUowCompleted(Payment payment)
+ {
+ _unitOfWorkManager.Current.OnCompleted(async () =>
{
- _objectMapper.Map(eventData.Entity, payment);
+ await _distributedEventBus.PublishAsync(new EShopPaymentCanceledEto
+ {
+ Payment = _objectMapper.Map(payment)
+ });
+ });
+ }
- foreach (var etoItem in eventData.Entity.PaymentItems)
+ protected virtual void PublishPaymentCompletedEventOnUowCompleted(Payment payment)
+ {
+ _unitOfWorkManager.Current.OnCompleted(async () =>
+ {
+ await _distributedEventBus.PublishAsync(new EShopPaymentCompletedEto
{
- var item = payment.PaymentItems.FirstOrDefault(i => i.Id == etoItem.Id);
-
- if (item == null)
- {
- if (!Guid.TryParse(etoItem.GetProperty("StoreId"), out var storeId))
- {
- throw new StoreIdNotFoundException();
- }
-
- item = _objectMapper.Map(etoItem);
-
- item.SetStoreId(storeId);
-
- payment.PaymentItems.Add(item);
- }
- else
- {
- _objectMapper.Map(etoItem, item);
- }
- }
+ Payment = _objectMapper.Map(payment)
+ });
+ });
+ }
+
+ [UnitOfWork(true)]
+ public virtual async Task HandleEventAsync(EntityUpdatedEto eventData)
+ {
+ if (eventData.Entity.PaymentItems.All(item => item.ItemType != PaymentsConsts.PaymentItemType))
+ {
+ return;
+ }
+
+ using var changeTenant = _currentTenant.Change(eventData.Entity.TenantId);
+
+ var payment = await _paymentRepository.FindAsync(eventData.Entity.Id);
+
+ if (payment == null)
+ {
+ return;
+ }
+
+ if (eventData.Entity.CompletionTime.HasValue && !payment.CompletionTime.HasValue)
+ {
+ PublishPaymentCompletedEventOnUowCompleted(payment);
+ }
+
+ if (eventData.Entity.CanceledTime.HasValue && !payment.CanceledTime.HasValue)
+ {
+ PublishPaymentCanceledEventOnUowCompleted(payment);
+ }
- var etoPaymentItemIds = eventData.Entity.PaymentItems.Select(i => i.Id).ToList();
+ _objectMapper.Map(eventData.Entity, payment);
+
+ foreach (var etoItem in eventData.Entity.PaymentItems)
+ {
+ var item = payment.PaymentItems.FirstOrDefault(i => i.Id == etoItem.Id);
- payment.PaymentItems.RemoveAll(i => !etoPaymentItemIds.Contains(i.Id));
+ if (item == null)
+ {
+ item = _objectMapper.Map(etoItem);
+
+ FillPaymentItemStoreId(item);
+
+ payment.PaymentItems.Add(item);
+ }
+ else
+ {
+ _objectMapper.Map(etoItem, item);
+ }
}
+
+ var etoPaymentItemIds = eventData.Entity.PaymentItems.Select(i => i.Id).ToList();
+
+ payment.PaymentItems.RemoveAll(i => !etoPaymentItemIds.Contains(i.Id));
await _paymentRepository.UpdateAsync(payment, true);
}
+ protected virtual void FillPaymentItemStoreId(PaymentItem item)
+ {
+ if (!Guid.TryParse(item.GetProperty("StoreId"), out var storeId))
+ {
+ throw new StoreIdNotFoundException();
+ }
+
+ item.SetStoreId(storeId);
+ }
+
+ [UnitOfWork(true)]
public virtual async Task HandleEventAsync(EntityDeletedEto eventData)
{
+ using var changeTenant = _currentTenant.Change(eventData.Entity.TenantId);
+
var payment = await _paymentRepository.FindAsync(eventData.Entity.Id);
if (payment == null)
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/PaymentsDomainAutoMapperProfile.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/PaymentsDomainAutoMapperProfile.cs
index 0acbe699..91f63bde 100644
--- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/PaymentsDomainAutoMapperProfile.cs
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/PaymentsDomainAutoMapperProfile.cs
@@ -23,7 +23,14 @@ namespace EasyAbp.EShop.Payments
CreateMap(MemberList.Source)
.Ignore(x => x.RefundItems);
CreateMap(MemberList.Source)
- .Ignore(x => x.StoreId);
+ .Ignore(x => x.StoreId)
+ .Ignore(x => x.OrderId);
+
+ CreateMap();
+ CreateMap();
+ CreateMap();
+ CreateMap();
+ CreateMap();
}
}
}
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Refunds/Refund.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Refunds/Refund.cs
index a440f3fb..d5ab40c0 100644
--- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Refunds/Refund.cs
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Refunds/Refund.cs
@@ -1,13 +1,11 @@
using System;
using System.Collections.Generic;
-using AutoMapper;
using EasyAbp.PaymentService.Refunds;
using JetBrains.Annotations;
using Volo.Abp.Domain.Entities.Auditing;
namespace EasyAbp.EShop.Payments.Refunds
{
- [AutoMap(typeof(EShopRefundEto))]
public class Refund : FullAuditedAggregateRoot, IRefund
{
#region Base properties
@@ -39,10 +37,10 @@ namespace EasyAbp.EShop.Payments.Refunds
public virtual DateTime? CanceledTime { get; protected set; }
- public virtual List RefundItems { get; protected set; }
-
#endregion
+ public virtual List RefundItems { get; protected set; }
+
private Refund()
{
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Refunds/RefundItem.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Refunds/RefundItem.cs
index 6c9da51f..3d7f0502 100644
--- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Refunds/RefundItem.cs
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Refunds/RefundItem.cs
@@ -1,16 +1,12 @@
using System;
using System.Collections.Generic;
-using AutoMapper;
using EasyAbp.EShop.Stores.Stores;
using EasyAbp.PaymentService.Refunds;
-using JetBrains.Annotations;
using Volo.Abp.Data;
using Volo.Abp.Domain.Entities.Auditing;
namespace EasyAbp.EShop.Payments.Refunds
{
- [AutoMap(typeof(EShopRefundItemEto))]
-
public class RefundItem : FullAuditedEntity, IRefundItem, IMultiStore, IHasExtraProperties
{
#region Base properties
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Refunds/RefundSynchronizer.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Refunds/RefundSynchronizer.cs
index 750edf44..285e7ae3 100644
--- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Refunds/RefundSynchronizer.cs
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Refunds/RefundSynchronizer.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using EasyAbp.EShop.Payments.Payments;
using EasyAbp.PaymentService.Refunds;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
@@ -9,86 +10,141 @@ using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.Guids;
using Volo.Abp.Json;
+using Volo.Abp.MultiTenancy;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Uow;
namespace EasyAbp.EShop.Payments.Refunds
{
public class RefundSynchronizer :
- IDistributedEventHandler>,
- IDistributedEventHandler>,
+ IDistributedEventHandler>,
+ IDistributedEventHandler>,
+ IDistributedEventHandler>,
IRefundSynchronizer,
ITransientDependency
{
private readonly IObjectMapper _objectMapper;
+ private readonly ICurrentTenant _currentTenant;
private readonly IGuidGenerator _guidGenerator;
private readonly IJsonSerializer _jsonSerializer;
+ private readonly IUnitOfWorkManager _unitOfWorkManager;
+ private readonly IDistributedEventBus _distributedEventBus;
+ private readonly IPaymentRepository _paymentRepository;
private readonly IRefundRepository _refundRepository;
public RefundSynchronizer(
IObjectMapper objectMapper,
+ ICurrentTenant currentTenant,
IGuidGenerator guidGenerator,
IJsonSerializer jsonSerializer,
+ IUnitOfWorkManager unitOfWorkManager,
+ IDistributedEventBus distributedEventBus,
+ IPaymentRepository paymentRepository,
IRefundRepository refundRepository)
{
_objectMapper = objectMapper;
+ _currentTenant = currentTenant;
_guidGenerator = guidGenerator;
_jsonSerializer = jsonSerializer;
+ _unitOfWorkManager = unitOfWorkManager;
+ _distributedEventBus = distributedEventBus;
+ _paymentRepository = paymentRepository;
_refundRepository = refundRepository;
}
+
+ [UnitOfWork(true)]
+ public virtual async Task HandleEventAsync(EntityCreatedEto eventData)
+ {
+ using var changeTenant = _currentTenant.Change(eventData.Entity.TenantId);
+
+ var refund = await _refundRepository.FindAsync(eventData.Entity.Id);
+
+ if (refund != null)
+ {
+ return;
+ }
+
+ var payment = await _paymentRepository.FindAsync(eventData.Entity.PaymentId);
+
+ if (payment == null)
+ {
+ return;
+ }
+
+ refund = _objectMapper.Map(eventData.Entity);
+
+ refund.SetRefundItems(
+ _objectMapper.Map, List>(eventData.Entity.RefundItems));
+
+ refund.RefundItems.ForEach(item =>
+ {
+ FillRefundItemStoreId(item);
+ FillRefundItemOrderId(item);
+ });
+
+ FillRefundItemOrderLines(refund);
+
+ await _refundRepository.InsertAsync(refund, true);
+
+ if (refund.CompletedTime.HasValue)
+ {
+ _unitOfWorkManager.Current.OnCompleted(async () =>
+ await _distributedEventBus.PublishAsync(new EShopRefundCompletedEto
+ {Refund = _objectMapper.Map(refund)}));
+ }
+ }
[UnitOfWork(true)]
- public virtual async Task HandleEventAsync(EntityUpdatedEto eventData)
+ public virtual async Task HandleEventAsync(EntityUpdatedEto eventData)
{
+ using var changeTenant = _currentTenant.Change(eventData.Entity.TenantId);
+
var refund = await _refundRepository.FindAsync(eventData.Entity.Id);
if (refund == null)
{
- refund = _objectMapper.Map(eventData.Entity);
-
- refund.SetRefundItems(
- _objectMapper.Map, List>(eventData.Entity.RefundItems));
+ return;
+ }
- await _refundRepository.InsertAsync(refund, true);
+ if (eventData.Entity.CompletedTime.HasValue && !refund.CompletedTime.HasValue)
+ {
+ _unitOfWorkManager.Current.OnCompleted(async () =>
+ await _distributedEventBus.PublishAsync(new EShopRefundCompletedEto
+ {Refund = _objectMapper.Map(refund)}));
}
- else
+
+ _objectMapper.Map(eventData.Entity, refund);
+
+ foreach (var etoItem in eventData.Entity.RefundItems)
{
- _objectMapper.Map(eventData.Entity, refund);
+ var item = refund.RefundItems.FirstOrDefault(i => i.Id == etoItem.Id);
- foreach (var etoItem in eventData.Entity.RefundItems)
+ if (item == null)
{
- var item = refund.RefundItems.FirstOrDefault(i => i.Id == etoItem.Id);
-
- if (item == null)
- {
- if (!Guid.TryParse(etoItem.GetProperty("StoreId"), out var storeId))
- {
- throw new StoreIdNotFoundException();
- }
-
- if (!Guid.TryParse(etoItem.GetProperty("OrderId"), out var orderId))
- {
- throw new OrderIdNotFoundException();
- }
+ item = _objectMapper.Map(etoItem);
- item = _objectMapper.Map(etoItem);
-
- item.SetStoreId(storeId);
- item.SetOrderId(orderId);
-
- refund.RefundItems.Add(item);
- }
- else
- {
- _objectMapper.Map(etoItem, item);
- }
+ refund.RefundItems.Add(item);
+ }
+ else
+ {
+ _objectMapper.Map(etoItem, item);
}
-
- var etoRefundItemIds = eventData.Entity.RefundItems.Select(i => i.Id).ToList();
- refund.RefundItems.RemoveAll(i => !etoRefundItemIds.Contains(i.Id));
+ FillRefundItemStoreId(item);
+ FillRefundItemOrderId(item);
}
+
+ var etoRefundItemIds = eventData.Entity.RefundItems.Select(i => i.Id).ToList();
+
+ refund.RefundItems.RemoveAll(i => !etoRefundItemIds.Contains(i.Id));
+
+ FillRefundItemOrderLines(refund);
+
+ await _refundRepository.UpdateAsync(refund, true);
+ }
+ protected virtual void FillRefundItemOrderLines(Refund refund)
+ {
foreach (var refundItem in refund.RefundItems)
{
var orderLineInfoModels =
@@ -115,12 +171,33 @@ namespace EasyAbp.EShop.Payments.Refunds
refundItem.RefundItemOrderLines.RemoveAll(i => !orderLineIds.Contains(i.OrderLineId));
}
}
-
- await _refundRepository.UpdateAsync(refund, true);
}
- public virtual async Task HandleEventAsync(EntityDeletedEto eventData)
+ protected virtual void FillRefundItemStoreId(RefundItem item)
+ {
+ if (!Guid.TryParse(item.GetProperty("StoreId"), out var storeId))
+ {
+ throw new StoreIdNotFoundException();
+ }
+
+ item.SetStoreId(storeId);
+ }
+
+ protected virtual void FillRefundItemOrderId(RefundItem item)
{
+ if (!Guid.TryParse(item.GetProperty("OrderId"), out var orderId))
+ {
+ throw new OrderIdNotFoundException();
+ }
+
+ item.SetOrderId(orderId);
+ }
+
+ [UnitOfWork(true)]
+ public virtual async Task HandleEventAsync(EntityDeletedEto eventData)
+ {
+ using var changeTenant = _currentTenant.Change(eventData.Entity.TenantId);
+
var refund = await _refundRepository.FindAsync(eventData.Entity.Id);
if (refund == null)
diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.EntityFrameworkCore/EasyAbp/EShop/Payments/Refunds/RefundRepository.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.EntityFrameworkCore/EasyAbp/EShop/Payments/Refunds/RefundRepository.cs
index ba552bfd..ab680473 100644
--- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.EntityFrameworkCore/EasyAbp/EShop/Payments/Refunds/RefundRepository.cs
+++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.EntityFrameworkCore/EasyAbp/EShop/Payments/Refunds/RefundRepository.cs
@@ -1,6 +1,7 @@
using System;
using System.Linq;
using EasyAbp.EShop.Payments.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
@@ -12,6 +13,11 @@ namespace EasyAbp.EShop.Payments.Refunds
{
}
+ public override IQueryable WithDetails()
+ {
+ return base.WithDetails().Include(x => x.RefundItems);
+ }
+
public IQueryable GetQueryableByUserId(Guid userId)
{
return from refund in DbContext.Refunds
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/CreateUpdateProductDto.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/CreateUpdateProductDto.cs
index 8933b243..b4a73206 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/CreateUpdateProductDto.cs
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/CreateUpdateProductDto.cs
@@ -40,9 +40,6 @@ namespace EasyAbp.EShop.Products.Products.Dtos
[DisplayName("ProductMediaResources")]
public string MediaResources { get; set; }
-
- [DisplayName("ProductSpecifiedInventoryProviderName")]
- public string SpecifiedInventoryProviderName { get; set; }
[DisplayName("ProductIsPublished")]
public bool IsPublished { get; set; }
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/CreateUpdateProductSkuDto.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/CreateUpdateProductSkuDto.cs
index 9e1c8520..1ad43583 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/CreateUpdateProductSkuDto.cs
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/CreateUpdateProductSkuDto.cs
@@ -30,10 +30,7 @@ namespace EasyAbp.EShop.Products.Products.Dtos
[DisplayName("ProductSkuMediaResources")]
public string MediaResources { get; set; }
-
- [DisplayName("ProductSkuSpecifiedInventoryProviderName")]
- public string SpecifiedInventoryProviderName { get; set; }
-
+
[DisplayName("ProductSkuProductDetailId")]
public Guid? ProductDetailId { get; set; }
}
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/ProductDto.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/ProductDto.cs
index 2658a708..1de547c5 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/ProductDto.cs
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/ProductDto.cs
@@ -22,8 +22,6 @@ namespace EasyAbp.EShop.Products.Products.Dtos
public string MediaResources { get; set; }
- public string SpecifiedInventoryProviderName { get; set; }
-
public int DisplayOrder { get; set; }
public bool IsPublished { get; set; }
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/ProductSkuDto.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/ProductSkuDto.cs
index 50cf54a9..fdad70fc 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/ProductSkuDto.cs
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/ProductSkuDto.cs
@@ -31,8 +31,6 @@ namespace EasyAbp.EShop.Products.Products.Dtos
public string MediaResources { get; set; }
- public string SpecifiedInventoryProviderName { get; set; }
-
public Guid? ProductDetailId { get; set; }
}
}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/ProductAppService.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/ProductAppService.cs
index 8444606e..76782927 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/ProductAppService.cs
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/ProductAppService.cs
@@ -25,6 +25,7 @@ namespace EasyAbp.EShop.Products.Products
protected override string GetListPolicyName { get; set; } = null;
private readonly IProductManager _productManager;
+ private readonly IProductPriceProvider _productPriceProvider;
private readonly IProductInventoryProvider _productInventoryProvider;
private readonly IAttributeOptionIdsSerializer _attributeOptionIdsSerializer;
private readonly IProductStoreRepository _productStoreRepository;
@@ -33,6 +34,7 @@ namespace EasyAbp.EShop.Products.Products
public ProductAppService(
IProductManager productManager,
+ IProductPriceProvider productPriceProvider,
IProductInventoryProvider productInventoryProvider,
IAttributeOptionIdsSerializer attributeOptionIdsSerializer,
IProductStoreRepository productStoreRepository,
@@ -40,6 +42,7 @@ namespace EasyAbp.EShop.Products.Products
IProductRepository repository) : base(repository)
{
_productManager = productManager;
+ _productPriceProvider = productPriceProvider;
_productInventoryProvider = productInventoryProvider;
_attributeOptionIdsSerializer = attributeOptionIdsSerializer;
_productStoreRepository = productStoreRepository;
@@ -73,7 +76,12 @@ namespace EasyAbp.EShop.Products.Products
await _productManager.CreateAsync(product, input.StoreId, input.CategoryIds);
- return MapToGetOutputDto(product);
+ var dto = MapToGetOutputDto(product);
+
+ await LoadDtoExtraDataAsync(product, dto, input.StoreId);
+ await LoadDtosProductTypeUniqueNameAsync(new[] {dto});
+
+ return dto;
}
public override async Task UpdateAsync(Guid id, CreateUpdateProductDto input)
@@ -92,7 +100,12 @@ namespace EasyAbp.EShop.Products.Products
await _productManager.UpdateAsync(product, input.CategoryIds);
- return MapToGetOutputDto(product);
+ var dto = MapToGetOutputDto(product);
+
+ await LoadDtoExtraDataAsync(product, dto, input.StoreId);
+ await LoadDtosProductTypeUniqueNameAsync(new[] {dto});
+
+ return dto;
}
protected virtual async Task CheckStoreIsProductOwnerAsync(Guid productId, Guid storeId)
@@ -205,9 +218,7 @@ namespace EasyAbp.EShop.Products.Products
var dto = MapToGetOutputDto(product);
- await LoadDtoInventoryDataAsync(product, dto, storeId);
- await LoadDtoPriceAsync(product, dto, storeId);
-
+ await LoadDtoExtraDataAsync(product, dto, storeId);
await LoadDtosProductTypeUniqueNameAsync(new[] {dto});
return dto;
@@ -236,7 +247,8 @@ namespace EasyAbp.EShop.Products.Products
var dto = MapToGetOutputDto(product);
- await LoadDtoInventoryDataAsync(product, dto, storeId);
+ await LoadDtoExtraDataAsync(product, dto, storeId);
+ await LoadDtosProductTypeUniqueNameAsync(new[] {dto});
return dto;
}
@@ -275,8 +287,7 @@ namespace EasyAbp.EShop.Products.Products
{
var productDto = MapToGetListOutputDto(product);
- await LoadDtoInventoryDataAsync(product, productDto, input.StoreId);
- await LoadDtoPriceAsync(product, productDto, input.StoreId);
+ await LoadDtoExtraDataAsync(product, productDto, input.StoreId);
items.Add(productDto);
}
@@ -305,12 +316,24 @@ namespace EasyAbp.EShop.Products.Products
return productDto;
}
- protected virtual async Task LoadDtoPriceAsync(Product product, ProductDto productDto, Guid storeId)
+ protected virtual async Task LoadDtoExtraDataAsync(Product product, ProductDto productDto, Guid storeId)
{
- foreach (var productSkuDto in productDto.ProductSkus)
+ await LoadDtoInventoryDataAsync(product, productDto, storeId);
+ await LoadDtoPriceDataAsync(product, productDto, storeId);
+
+ return productDto;
+ }
+
+ protected virtual async Task LoadDtoPriceDataAsync(Product product, ProductDto productDto, Guid storeId)
+ {
+ foreach (var productSku in product.ProductSkus)
{
- productSkuDto.DiscountedPrice = await _productManager.GetDiscountedPriceAsync(product,
- product.ProductSkus.Single(sku => sku.Id == productSkuDto.Id), storeId);
+ var productSkuDto = productDto.ProductSkus.First(x => x.Id == productSku.Id);
+
+ var priceDataModel = await _productManager.GetProductPriceAsync(product, productSku, storeId);
+
+ productSkuDto.Price = priceDataModel.Price;
+ productSkuDto.DiscountedPrice = priceDataModel.DiscountedPrice;
}
if (productDto.ProductSkus.Count > 0)
@@ -359,7 +382,12 @@ namespace EasyAbp.EShop.Products.Products
await _productManager.CreateSkuAsync(product, sku);
- return ObjectMapper.Map(product);
+ var dto = MapToGetOutputDto(product);
+
+ await LoadDtoExtraDataAsync(product, dto, storeId);
+ await LoadDtosProductTypeUniqueNameAsync(new[] {dto});
+
+ return dto;
}
public async Task UpdateSkuAsync(Guid productId, Guid productSkuId, Guid storeId,
@@ -379,7 +407,12 @@ namespace EasyAbp.EShop.Products.Products
await _productManager.UpdateSkuAsync(product, sku);
- return ObjectMapper.Map(product);
+ var dto = MapToGetOutputDto(product);
+
+ await LoadDtoExtraDataAsync(product, dto, storeId);
+ await LoadDtosProductTypeUniqueNameAsync(new[] {dto});
+
+ return dto;
}
public async Task DeleteSkuAsync(Guid productId, Guid productSkuId, Guid storeId)
@@ -396,7 +429,12 @@ namespace EasyAbp.EShop.Products.Products
await _productManager.DeleteSkuAsync(product, sku);
- return ObjectMapper.Map(product);
+ var dto = MapToGetOutputDto(product);
+
+ await LoadDtoExtraDataAsync(product, dto, storeId);
+ await LoadDtosProductTypeUniqueNameAsync(new[] {dto});
+
+ return dto;
}
}
}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductsApplicationAutoMapperProfile.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductsApplicationAutoMapperProfile.cs
index 5e349cc1..f9d7bfc1 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductsApplicationAutoMapperProfile.cs
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductsApplicationAutoMapperProfile.cs
@@ -39,6 +39,7 @@ namespace EasyAbp.EShop.Products
CreateMap()
.ForSourceMember(entity => entity.SerializedAttributeOptionIds, opt => opt.DoNotValidate())
.Ignore(dto => dto.AttributeOptionIds)
+ .Ignore(dto => dto.Price)
.Ignore(dto => dto.DiscountedPrice)
.Ignore(dto => dto.Inventory)
.Ignore(dto => dto.Sold)
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/cs.json b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/cs.json
index 04d5ed85..6087d675 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/cs.json
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/cs.json
@@ -1,7 +1,6 @@
{
"culture": "cs",
"texts": {
- "KeepEmptyIfDoNotKnow": "KeepEmptyIfDoNotKnow",
"Menu:Product": "MenuProduct",
"Product": "Product",
"ProductStore": "ProductStore",
@@ -31,7 +30,6 @@
"ProductSkuOrderMinQuantity": "ProductSkuOrderMinQuantity",
"ProductSkuOrderMaxQuantity": "ProductSkuOrderMaxQuantity",
"ProductSkuMediaResources": "ProductSkuMediaResources",
- "ProductSkuSpecifiedInventoryProviderName": "ProductSkuSpecifiedInventoryProviderName",
"ProductSkuProductDetailId": "ProductSkuProductDetailId",
"ProductSkuContentDescription": "ProductSkuContentDescription",
"CreateProductSku": "CreateProductSku",
@@ -40,7 +38,6 @@
"ProductInventoryStrategy": "ProductInventoryStrategy",
"ProductIsPublished": "ProductIsPublished",
"ProductMediaResources": "ProductMediaResources",
- "ProductSpecifiedInventoryProviderName": "ProductSpecifiedInventoryProviderName",
"ProductAttributeDisplayName": "ProductAttributeDisplayName",
"ProductAttributeDescription": "ProductAttributeDescription",
"ProductAttributeDisplayOrder": "ProductAttributeDisplayOrder",
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/en.json b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/en.json
index bcacfba3..0bf6372a 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/en.json
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/en.json
@@ -2,7 +2,6 @@
"culture": "en",
"texts": {
"ManageYourProfile": "Manage your profile",
- "KeepEmptyIfDoNotKnow": "KeepEmptyIfDoNotKnow",
"Menu:Product": "MenuProduct",
"Product": "Product",
"ProductStore": "ProductStore",
@@ -32,7 +31,6 @@
"ProductSkuOrderMinQuantity": "ProductSkuOrderMinQuantity",
"ProductSkuOrderMaxQuantity": "ProductSkuOrderMaxQuantity",
"ProductSkuMediaResources": "ProductSkuMediaResources",
- "ProductSkuSpecifiedInventoryProviderName": "ProductSkuSpecifiedInventoryProviderName",
"ProductSkuProductDetailId": "ProductSkuProductDetailId",
"ProductSkuContentDescription": "ProductSkuContentDescription",
"CreateProductSku": "CreateProductSku",
@@ -41,7 +39,6 @@
"ProductInventoryStrategy": "ProductInventoryStrategy",
"ProductIsPublished": "ProductIsPublished",
"ProductMediaResources": "ProductMediaResources",
- "ProductSpecifiedInventoryProviderName": "ProductSpecifiedInventoryProviderName",
"ProductAttributeDisplayName": "ProductAttributeDisplayName",
"ProductAttributeDescription": "ProductAttributeDescription",
"ProductAttributeDisplayOrder": "ProductAttributeDisplayOrder",
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/pl.json b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/pl.json
index e19e1025..fe57f76b 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/pl.json
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/pl.json
@@ -1,7 +1,6 @@
{
"culture": "pl",
"texts": {
- "KeepEmptyIfDoNotKnow": "KeepEmptyIfDoNotKnow",
"Menu:Product": "MenuProduct",
"Product": "Product",
"ProductStore": "ProductStore",
@@ -31,7 +30,6 @@
"ProductSkuOrderMinQuantity": "ProductSkuOrderMinQuantity",
"ProductSkuOrderMaxQuantity": "ProductSkuOrderMaxQuantity",
"ProductSkuMediaResources": "ProductSkuMediaResources",
- "ProductSkuSpecifiedInventoryProviderName": "ProductSkuSpecifiedInventoryProviderName",
"ProductSkuProductDetailId": "ProductSkuProductDetailId",
"ProductSkuContentDescription": "ProductSkuContentDescription",
"CreateProductSku": "CreateProductSku",
@@ -40,7 +38,6 @@
"ProductInventoryStrategy": "ProductInventoryStrategy",
"ProductIsPublished": "ProductIsPublished",
"ProductMediaResources": "ProductMediaResources",
- "ProductSpecifiedInventoryProviderName": "ProductSpecifiedInventoryProviderName",
"ProductAttributeDisplayName": "ProductAttributeDisplayName",
"ProductAttributeDescription": "ProductAttributeDescription",
"ProductAttributeDisplayOrder": "ProductAttributeDisplayOrder",
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/pt-BR.json b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/pt-BR.json
index 8d06c64e..588971b0 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/pt-BR.json
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/pt-BR.json
@@ -1,7 +1,6 @@
{
"culture": "pt-BR",
"texts": {
- "KeepEmptyIfDoNotKnow": "KeepEmptyIfDoNotKnow",
"Menu:Product": "MenuProduct",
"Product": "Product",
"ProductStore": "ProductStore",
@@ -31,7 +30,6 @@
"ProductSkuOrderMinQuantity": "ProductSkuOrderMinQuantity",
"ProductSkuOrderMaxQuantity": "ProductSkuOrderMaxQuantity",
"ProductSkuMediaResources": "ProductSkuMediaResources",
- "ProductSkuSpecifiedInventoryProviderName": "ProductSkuSpecifiedInventoryProviderName",
"ProductSkuProductDetailId": "ProductSkuProductDetailId",
"ProductSkuContentDescription": "ProductSkuContentDescription",
"CreateProductSku": "CreateProductSku",
@@ -40,7 +38,6 @@
"ProductInventoryStrategy": "ProductInventoryStrategy",
"ProductIsPublished": "ProductIsPublished",
"ProductMediaResources": "ProductMediaResources",
- "ProductSpecifiedInventoryProviderName": "ProductSpecifiedInventoryProviderName",
"ProductAttributeDisplayName": "ProductAttributeDisplayName",
"ProductAttributeDescription": "ProductAttributeDescription",
"ProductAttributeDisplayOrder": "ProductAttributeDisplayOrder",
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/sl.json b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/sl.json
index 8f965107..1c50cf10 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/sl.json
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/sl.json
@@ -2,7 +2,6 @@
"culture": "sl",
"texts": {
"ManageYourProfile": "Upravljajte svojim profilom",
- "KeepEmptyIfDoNotKnow": "KeepEmptyIfDoNotKnow",
"Menu:Product": "MenuProduct",
"Product": "Product",
"ProductStore": "ProductStore",
@@ -32,7 +31,6 @@
"ProductSkuOrderMinQuantity": "ProductSkuOrderMinQuantity",
"ProductSkuOrderMaxQuantity": "ProductSkuOrderMaxQuantity",
"ProductSkuMediaResources": "ProductSkuMediaResources",
- "ProductSkuSpecifiedInventoryProviderName": "ProductSkuSpecifiedInventoryProviderName",
"ProductSkuProductDetailId": "ProductSkuProductDetailId",
"ProductSkuContentDescription": "ProductSkuContentDescription",
"CreateProductSku": "CreateProductSku",
@@ -41,7 +39,6 @@
"ProductInventoryStrategy": "ProductInventoryStrategy",
"ProductIsPublished": "ProductIsPublished",
"ProductMediaResources": "ProductMediaResources",
- "ProductSpecifiedInventoryProviderName": "ProductSpecifiedInventoryProviderName",
"ProductAttributeDisplayName": "ProductAttributeDisplayName",
"ProductAttributeDescription": "ProductAttributeDescription",
"ProductAttributeDisplayOrder": "ProductAttributeDisplayOrder",
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/tr.json b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/tr.json
index d18c1a81..665f5c7a 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/tr.json
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/tr.json
@@ -2,7 +2,6 @@
"culture": "tr",
"texts": {
"ManageYourProfile": "Profil y�netimi",
- "KeepEmptyIfDoNotKnow": "KeepEmptyIfDoNotKnow",
"Menu:Product": "MenuProduct",
"Product": "Product",
"ProductStore": "ProductStore",
@@ -32,7 +31,6 @@
"ProductSkuOrderMinQuantity": "ProductSkuOrderMinQuantity",
"ProductSkuOrderMaxQuantity": "ProductSkuOrderMaxQuantity",
"ProductSkuMediaResources": "ProductSkuMediaResources",
- "ProductSkuSpecifiedInventoryProviderName": "ProductSkuSpecifiedInventoryProviderName",
"ProductSkuProductDetailId": "ProductSkuProductDetailId",
"ProductSkuContentDescription": "ProductSkuContentDescription",
"CreateProductSku": "CreateProductSku",
@@ -41,7 +39,6 @@
"ProductInventoryStrategy": "ProductInventoryStrategy",
"ProductIsPublished": "ProductIsPublished",
"ProductMediaResources": "ProductMediaResources",
- "ProductSpecifiedInventoryProviderName": "ProductSpecifiedInventoryProviderName",
"ProductAttributeDisplayName": "ProductAttributeDisplayName",
"ProductAttributeDescription": "ProductAttributeDescription",
"ProductAttributeDisplayOrder": "ProductAttributeDisplayOrder",
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/vi.json b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/vi.json
index 1493cddd..810cb298 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/vi.json
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/vi.json
@@ -1,7 +1,6 @@
{
"culture": "vi",
"texts": {
- "KeepEmptyIfDoNotKnow": "KeepEmptyIfDoNotKnow",
"Menu:Product": "MenuProduct",
"Product": "Product",
"ProductStore": "ProductStore",
@@ -31,7 +30,6 @@
"ProductSkuOrderMinQuantity": "ProductSkuOrderMinQuantity",
"ProductSkuOrderMaxQuantity": "ProductSkuOrderMaxQuantity",
"ProductSkuMediaResources": "ProductSkuMediaResources",
- "ProductSkuSpecifiedInventoryProviderName": "ProductSkuSpecifiedInventoryProviderName",
"ProductSkuProductDetailId": "ProductSkuProductDetailId",
"ProductSkuContentDescription": "ProductSkuContentDescription",
"CreateProductSku": "CreateProductSku",
@@ -40,7 +38,6 @@
"ProductInventoryStrategy": "ProductInventoryStrategy",
"ProductIsPublished": "ProductIsPublished",
"ProductMediaResources": "ProductMediaResources",
- "ProductSpecifiedInventoryProviderName": "ProductSpecifiedInventoryProviderName",
"ProductAttributeDisplayName": "ProductAttributeDisplayName",
"ProductAttributeDescription": "ProductAttributeDescription",
"ProductAttributeDisplayOrder": "ProductAttributeDisplayOrder",
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/zh-Hans.json b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/zh-Hans.json
index f35b7a81..9053df08 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/zh-Hans.json
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/zh-Hans.json
@@ -2,7 +2,6 @@
"culture": "zh-Hans",
"texts": {
"ManageYourProfile": "管理个人资料",
- "KeepEmptyIfDoNotKnow": "KeepEmptyIfDoNotKnow",
"Menu:Product": "MenuProduct",
"Product": "Product",
"ProductStore": "ProductStore",
@@ -32,7 +31,6 @@
"ProductSkuOrderMinQuantity": "ProductSkuOrderMinQuantity",
"ProductSkuOrderMaxQuantity": "ProductSkuOrderMaxQuantity",
"ProductSkuMediaResources": "ProductSkuMediaResources",
- "ProductSkuSpecifiedInventoryProviderName": "ProductSkuSpecifiedInventoryProviderName",
"ProductSkuProductDetailId": "ProductSkuProductDetailId",
"ProductSkuContentDescription": "ProductSkuContentDescription",
"CreateProductSku": "CreateProductSku",
@@ -41,7 +39,6 @@
"ProductInventoryStrategy": "ProductInventoryStrategy",
"ProductIsPublished": "ProductIsPublished",
"ProductMediaResources": "ProductMediaResources",
- "ProductSpecifiedInventoryProviderName": "ProductSpecifiedInventoryProviderName",
"ProductAttributeDisplayName": "ProductAttributeDisplayName",
"ProductAttributeDescription": "ProductAttributeDescription",
"ProductAttributeDisplayOrder": "ProductAttributeDisplayOrder",
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/zh-Hant.json b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/zh-Hant.json
index cd981a5b..088df3f2 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/zh-Hant.json
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/zh-Hant.json
@@ -2,7 +2,6 @@
"culture": "zh-Hant",
"texts": {
"ManageYourProfile": "管理個人資料",
- "KeepEmptyIfDoNotKnow": "KeepEmptyIfDoNotKnow",
"Menu:Product": "MenuProduct",
"Product": "Product",
"ProductStore": "ProductStore",
@@ -32,7 +31,6 @@
"ProductSkuOrderMinQuantity": "ProductSkuOrderMinQuantity",
"ProductSkuOrderMaxQuantity": "ProductSkuOrderMaxQuantity",
"ProductSkuMediaResources": "ProductSkuMediaResources",
- "ProductSkuSpecifiedInventoryProviderName": "ProductSkuSpecifiedInventoryProviderName",
"ProductSkuProductDetailId": "ProductSkuProductDetailId",
"ProductSkuContentDescription": "ProductSkuContentDescription",
"CreateProductSku": "CreateProductSku",
@@ -41,7 +39,6 @@
"ProductInventoryStrategy": "ProductInventoryStrategy",
"ProductIsPublished": "ProductIsPublished",
"ProductMediaResources": "ProductMediaResources",
- "ProductSpecifiedInventoryProviderName": "ProductSpecifiedInventoryProviderName",
"ProductAttributeDisplayName": "ProductAttributeDisplayName",
"ProductAttributeDescription": "ProductAttributeDescription",
"ProductAttributeDisplayOrder": "ProductAttributeDisplayOrder",
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/DefaultProductInventoryProvider.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/DefaultProductInventoryProvider.cs
index 1082a1af..fea70a6b 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/DefaultProductInventoryProvider.cs
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/DefaultProductInventoryProvider.cs
@@ -11,8 +11,6 @@ namespace EasyAbp.EShop.Products.Products
{
public class DefaultProductInventoryProvider : IProductInventoryProvider, ITransientDependency
{
- public string ProviderName { get; } = "Default";
-
// Todo: should use IProductInventoryStore.
private readonly IUnitOfWorkManager _unitOfWorkManager;
private readonly IDistributedEventBus _distributedEventBus;
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/DefaultProductPriceProvider.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/DefaultProductPriceProvider.cs
new file mode 100644
index 00000000..7eec983c
--- /dev/null
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/DefaultProductPriceProvider.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
+
+namespace EasyAbp.EShop.Products.Products
+{
+ public class DefaultProductPriceProvider : IProductPriceProvider, ITransientDependency
+ {
+ public virtual Task GetPriceAsync(Product product, ProductSku productSku, Guid storeId)
+ {
+ return Task.FromResult(productSku.Price);
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductInventoryProvider.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductInventoryProvider.cs
index 409673a1..923ae0b8 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductInventoryProvider.cs
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductInventoryProvider.cs
@@ -6,8 +6,6 @@ namespace EasyAbp.EShop.Products.Products
{
public interface IProductInventoryProvider
{
- string ProviderName { get; }
-
Task GetInventoryDataAsync(Product product, ProductSku productSku, Guid storeId);
Task> GetInventoryDataDictionaryAsync(Product product, Guid storeId);
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductManager.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductManager.cs
index 02a2ef87..dc7e4ff5 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductManager.cs
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductManager.cs
@@ -28,7 +28,7 @@ namespace EasyAbp.EShop.Products.Products
Task TryIncreaseInventoryAsync(Product product, ProductSku productSku, Guid storeId, int quantity, bool reduceSold);
Task TryReduceInventoryAsync(Product product, ProductSku productSku, Guid storeId, int quantity, bool increaseSold);
-
- Task GetDiscountedPriceAsync(Product product, ProductSku productSku, Guid storeId);
+
+ Task GetProductPriceAsync(Product product, ProductSku productSku, Guid storeId);
}
}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductPriceProvider.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductPriceProvider.cs
new file mode 100644
index 00000000..e4bd3163
--- /dev/null
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductPriceProvider.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Threading.Tasks;
+
+namespace EasyAbp.EShop.Products.Products
+{
+ public interface IProductPriceProvider
+ {
+ Task GetPriceAsync(Product product, ProductSku productSku, Guid storeId);
+ }
+}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/OrderCreatedEventHandler.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/OrderCreatedEventHandler.cs
index e797b8f0..3331cbe2 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/OrderCreatedEventHandler.cs
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/OrderCreatedEventHandler.cs
@@ -32,12 +32,11 @@ namespace EasyAbp.EShop.Products.Products
_productManager = productManager;
}
+ [UnitOfWork(true)]
public virtual async Task HandleEventAsync(EntityCreatedEto eventData)
{
using var changeTenant = _currentTenant.Change(eventData.Entity.TenantId);
- using var uow = _unitOfWorkManager.Begin(isTransactional: true);
-
var models = new List();
foreach (var orderLine in eventData.Entity.OrderLines)
@@ -84,14 +83,14 @@ namespace EasyAbp.EShop.Products.Products
continue;
}
- await uow.RollbackAsync();
+ await _unitOfWorkManager.Current.RollbackAsync();
await PublishResultEventAsync(eventData, false);
return;
}
- await uow.CompleteAsync();
+ await _unitOfWorkManager.Current.CompleteAsync();
await PublishResultEventAsync(eventData, true);
}
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/OrderPaidEventHandler.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/OrderPaidEventHandler.cs
index 11a76d58..abad9812 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/OrderPaidEventHandler.cs
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/OrderPaidEventHandler.cs
@@ -31,12 +31,11 @@ namespace EasyAbp.EShop.Products.Products
_productManager = productManager;
}
+ [UnitOfWork(true)]
public virtual async Task HandleEventAsync(OrderPaidEto eventData)
{
using var changeTenant = _currentTenant.Change(eventData.Order.TenantId);
- using var uow = _unitOfWorkManager.Begin(isTransactional: true);
-
var models = new List();
foreach (var orderLine in eventData.Order.OrderLines)
@@ -83,14 +82,14 @@ namespace EasyAbp.EShop.Products.Products
continue;
}
- await uow.RollbackAsync();
+ await _unitOfWorkManager.Current.RollbackAsync();
await PublishResultEventAsync(eventData, false);
return;
}
- await uow.CompleteAsync();
+ await _unitOfWorkManager.Current.CompleteAsync();
await PublishResultEventAsync(eventData, true);
}
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/PriceDataModel.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/PriceDataModel.cs
new file mode 100644
index 00000000..f8168434
--- /dev/null
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/PriceDataModel.cs
@@ -0,0 +1,9 @@
+namespace EasyAbp.EShop.Products.Products
+{
+ public class PriceDataModel
+ {
+ public decimal Price { get; set; }
+
+ public decimal DiscountedPrice { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/Product.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/Product.cs
index 782b0604..979bbcaf 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/Product.cs
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/Product.cs
@@ -21,9 +21,6 @@ namespace EasyAbp.EShop.Products.Products
[CanBeNull]
public virtual string MediaResources { get; protected set; }
-
- [CanBeNull]
- public virtual string SpecifiedInventoryProviderName { get; protected set; }
public virtual int DisplayOrder { get; protected set; }
@@ -52,7 +49,6 @@ namespace EasyAbp.EShop.Products.Products
bool isStatic,
bool isHidden,
[CanBeNull] string mediaResources,
- [CanBeNull] string specifiedInventoryProviderName,
int displayOrder
) : base(id)
{
@@ -65,7 +61,6 @@ namespace EasyAbp.EShop.Products.Products
IsStatic = isStatic;
IsHidden = isHidden;
MediaResources = mediaResources;
- SpecifiedInventoryProviderName = specifiedInventoryProviderName;
DisplayOrder = displayOrder;
ProductAttributes = new List();
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductManager.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductManager.cs
index a15d09c9..cd513785 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductManager.cs
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductManager.cs
@@ -11,23 +11,24 @@ namespace EasyAbp.EShop.Products.Products
{
public class ProductManager : DomainService, IProductManager
{
- protected Dictionary InventoryProviders;
-
private readonly IProductRepository _productRepository;
private readonly IProductStoreRepository _productStoreRepository;
+ private readonly IProductPriceProvider _productPriceProvider;
private readonly IProductCategoryRepository _productCategoryRepository;
- private readonly IAttributeOptionIdsSerializer _attributeOptionIdsSerializer;
+ private readonly IProductInventoryProvider _productInventoryProvider;
public ProductManager(
IProductRepository productRepository,
IProductStoreRepository productStoreRepository,
+ IProductPriceProvider productPriceProvider,
IProductCategoryRepository productCategoryRepository,
- IAttributeOptionIdsSerializer attributeOptionIdsSerializer)
+ IProductInventoryProvider productInventoryProvider)
{
_productRepository = productRepository;
_productStoreRepository = productStoreRepository;
+ _productPriceProvider = productPriceProvider;
_productCategoryRepository = productCategoryRepository;
- _attributeOptionIdsSerializer = attributeOptionIdsSerializer;
+ _productInventoryProvider = productInventoryProvider;
}
public virtual async Task CreateAsync(Product product, Guid? storeId = null,
@@ -184,54 +185,43 @@ namespace EasyAbp.EShop.Products.Products
public virtual async Task IsInventorySufficientAsync(Product product, ProductSku productSku, Guid storeId, int quantity)
{
- var inventoryData = await GetInventoryProviderOrDefault(product, productSku)
- .GetInventoryDataAsync(product, productSku, storeId);
+ var inventoryData = await _productInventoryProvider.GetInventoryDataAsync(product, productSku, storeId);
return product.InventoryStrategy == InventoryStrategy.NoNeed || inventoryData.Inventory - quantity >= 0;
}
public virtual async Task GetInventoryDataAsync(Product product, ProductSku productSku, Guid storeId)
{
- return await GetInventoryProviderOrDefault(product, productSku)
- .GetInventoryDataAsync(product, productSku, storeId);
+ return await _productInventoryProvider.GetInventoryDataAsync(product, productSku, storeId);
}
public virtual async Task TryIncreaseInventoryAsync(Product product, ProductSku productSku, Guid storeId, int quantity, bool reduceSold)
{
- return await GetInventoryProviderOrDefault(product, productSku)
- .TryIncreaseInventoryAsync(product, productSku, storeId, quantity, reduceSold);
+ return await _productInventoryProvider.TryIncreaseInventoryAsync(product, productSku, storeId, quantity, reduceSold);
}
public virtual async Task TryReduceInventoryAsync(Product product, ProductSku productSku, Guid storeId, int quantity, bool increaseSold)
{
- return await GetInventoryProviderOrDefault(product, productSku)
- .TryReduceInventoryAsync(product, productSku, storeId, quantity, increaseSold);
+ return await _productInventoryProvider.TryReduceInventoryAsync(product, productSku, storeId, quantity,
+ increaseSold);
}
- protected virtual IProductInventoryProvider GetInventoryProviderOrDefault(Product product, ProductSku productSku)
+ public virtual async Task GetProductPriceAsync(Product product, ProductSku productSku, Guid storeId)
{
- var providerName = !productSku.SpecifiedInventoryProviderName.IsNullOrWhiteSpace()
- ? productSku.SpecifiedInventoryProviderName
- : !product.SpecifiedInventoryProviderName.IsNullOrWhiteSpace()
- ? product.SpecifiedInventoryProviderName
- : "Default";
-
- InventoryProviders ??= ServiceProvider.GetServices()
- .ToDictionary(p => p.ProviderName, p => p);
-
- return InventoryProviders.GetOrDefault(providerName) ?? InventoryProviders["Default"];
- }
+ var price = await _productPriceProvider.GetPriceAsync(product, productSku, storeId);
- public virtual async Task GetDiscountedPriceAsync(Product product, ProductSku productSku, Guid storeId)
- {
- var currentPrice = productSku.Price;
+ var discountedPrice = price;
foreach (var provider in ServiceProvider.GetServices())
{
- currentPrice = await provider.GetDiscountedPriceAsync(product, productSku, storeId, currentPrice);
+ discountedPrice = await provider.GetDiscountedPriceAsync(product, productSku, storeId, discountedPrice);
}
- return currentPrice;
+ return new PriceDataModel
+ {
+ Price = price,
+ DiscountedPrice = discountedPrice
+ };
}
}
}
\ No newline at end of file
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductSku.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductSku.cs
index 1132f945..d7fc2f0c 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductSku.cs
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductSku.cs
@@ -25,10 +25,7 @@ namespace EasyAbp.EShop.Products.Products
[CanBeNull]
public virtual string MediaResources { get; protected set; }
-
- [CanBeNull]
- public virtual string SpecifiedInventoryProviderName { get; protected set; }
-
+
public Guid? ProductDetailId { get; set; }
protected ProductSku() {}
@@ -43,7 +40,6 @@ namespace EasyAbp.EShop.Products.Products
int orderMinQuantity,
int orderMaxQuantity,
[CanBeNull] string mediaResources,
- [CanBeNull] string specifiedInventoryProviderName,
Guid? productDetailId) : base(id)
{
SerializedAttributeOptionIds = serializedAttributeOptionIds;
@@ -54,7 +50,6 @@ namespace EasyAbp.EShop.Products.Products
OrderMinQuantity = orderMinQuantity;
OrderMaxQuantity = orderMaxQuantity;
MediaResources = mediaResources;
- SpecifiedInventoryProviderName = specifiedInventoryProviderName;
ProductDetailId = productDetailId;
}
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/ViewModels/CreateEditProductViewModel.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/ViewModels/CreateEditProductViewModel.cs
index 2ea2f6ae..e0f7fd02 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/ViewModels/CreateEditProductViewModel.cs
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/ViewModels/CreateEditProductViewModel.cs
@@ -53,10 +53,6 @@ namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product.ViewM
[Display(Name = "ProductMediaResources")]
public string MediaResources { get; set; }
- [Placeholder("KeepEmptyIfDoNotKnow")]
- [Display(Name = "ProductSpecifiedInventoryProviderName")]
- public string SpecifiedInventoryProviderName { get; set; }
-
[Display(Name = "ProductIsPublished")]
public bool IsPublished { get; set; }
}
diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/ProductSku/ViewModels/EditProductSkuViewModel.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/ProductSku/ViewModels/EditProductSkuViewModel.cs
index c3a54e48..3e6f487d 100644
--- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/ProductSku/ViewModels/EditProductSkuViewModel.cs
+++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/ProductSku/ViewModels/EditProductSkuViewModel.cs
@@ -35,10 +35,6 @@ namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.ProductSku.Vi
[Display(Name = "ProductSkuMediaResources")]
public string MediaResources { get; set; }
- [Placeholder("KeepEmptyIfDoNotKnow")]
- [Display(Name = "ProductSkuSpecifiedInventoryProviderName")]
- public string SpecifiedInventoryProviderName { get; set; }
-
[HiddenInput]
[Display(Name = "ProductSkuProductDetailId")]
public Guid? ProductDetailId { get; set; }
diff --git a/samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSample.Application.Contracts.csproj b/samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSample.Application.Contracts.csproj
index c5bdddfe..fe2130b0 100644
--- a/samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSample.Application.Contracts.csproj
+++ b/samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSample.Application.Contracts.csproj
@@ -14,8 +14,9 @@
-
-
+
+
+
diff --git a/samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSampleApplicationContractsModule.cs b/samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSampleApplicationContractsModule.cs
index 78c19a34..2907cfee 100644
--- a/samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSampleApplicationContractsModule.cs
+++ b/samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSampleApplicationContractsModule.cs
@@ -1,6 +1,7 @@
using EasyAbp.EShop;
using EasyAbp.EShop.Plugins.Baskets;
using EasyAbp.PaymentService;
+using EasyAbp.PaymentService.Prepayment;
using EasyAbp.PaymentService.WeChatPay;
using Volo.Abp.Account;
using Volo.Abp.FeatureManagement;
@@ -23,7 +24,8 @@ namespace EShopSample
typeof(EShopApplicationContractsModule),
typeof(EShopPluginsBasketsApplicationContractsModule),
typeof(PaymentServiceApplicationContractsModule),
- typeof(PaymentServiceWeChatPayApplicationContractsModule)
+ typeof(PaymentServiceWeChatPayApplicationContractsModule),
+ typeof(PaymentServicePrepaymentApplicationContractsModule)
)]
public class EShopSampleApplicationContractsModule : AbpModule
{
diff --git a/samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSample.Application.csproj b/samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSample.Application.csproj
index b84fe04f..01207c22 100644
--- a/samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSample.Application.csproj
+++ b/samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSample.Application.csproj
@@ -15,8 +15,9 @@
-
-
+
+
+
diff --git a/samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSampleApplicationModule.cs b/samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSampleApplicationModule.cs
index bc53d525..927f35ff 100644
--- a/samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSampleApplicationModule.cs
+++ b/samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSampleApplicationModule.cs
@@ -1,6 +1,7 @@
using EasyAbp.EShop;
using EasyAbp.EShop.Plugins.Baskets;
using EasyAbp.PaymentService;
+using EasyAbp.PaymentService.Prepayment;
using EasyAbp.PaymentService.WeChatPay;
using Volo.Abp.Account;
using Volo.Abp.AutoMapper;
@@ -23,7 +24,8 @@ namespace EShopSample
typeof(EShopApplicationModule),
typeof(EShopPluginsBasketsApplicationModule),
typeof(PaymentServiceApplicationModule),
- typeof(PaymentServiceWeChatPayApplicationModule)
+ typeof(PaymentServiceWeChatPayApplicationModule),
+ typeof(PaymentServicePrepaymentApplicationModule)
)]
public class EShopSampleApplicationModule : AbpModule
{
diff --git a/samples/EShopSample/aspnet-core/src/EShopSample.DbMigrator/appsettings.json b/samples/EShopSample/aspnet-core/src/EShopSample.DbMigrator/appsettings.json
index a7509d7e..177021b7 100644
--- a/samples/EShopSample/aspnet-core/src/EShopSample.DbMigrator/appsettings.json
+++ b/samples/EShopSample/aspnet-core/src/EShopSample.DbMigrator/appsettings.json
@@ -1,6 +1,7 @@
{
"ConnectionStrings": {
- "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=EShopSample;Trusted_Connection=True;MultipleActiveResultSets=true"
+ "Default": "Server=60.208.32.153;Database=fenghui01test;User Id=fenghui01test;Password=WYSytJdMORYnhTYmvf;Trusted_Connection=True;Integrated Security=false"
+
},
"IdentityServer": {
"Clients": {
diff --git a/samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSample.Domain.Shared.csproj b/samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSample.Domain.Shared.csproj
index a8d8824e..6623efbf 100644
--- a/samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSample.Domain.Shared.csproj
+++ b/samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSample.Domain.Shared.csproj
@@ -9,8 +9,9 @@
-
-
+
+
+
diff --git a/samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSampleDomainSharedModule.cs b/samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSampleDomainSharedModule.cs
index 2d63dd97..941236ce 100644
--- a/samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSampleDomainSharedModule.cs
+++ b/samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSampleDomainSharedModule.cs
@@ -1,6 +1,7 @@
using EasyAbp.EShop;
using EasyAbp.EShop.Plugins.Baskets;
using EasyAbp.PaymentService;
+using EasyAbp.PaymentService.Prepayment;
using EasyAbp.PaymentService.WeChatPay;
using EShopSample.Localization;
using Volo.Abp.AuditLogging;
@@ -30,7 +31,8 @@ namespace EShopSample
typeof(EShopDomainSharedModule),
typeof(EShopPluginsBasketsDomainSharedModule),
typeof(PaymentServiceDomainSharedModule),
- typeof(PaymentServiceWeChatPayDomainSharedModule)
+ typeof(PaymentServiceWeChatPayDomainSharedModule),
+ typeof(PaymentServicePrepaymentDomainSharedModule)
)]
public class EShopSampleDomainSharedModule : AbpModule
{
diff --git a/samples/EShopSample/aspnet-core/src/EShopSample.Domain/DefaultAccountGroup.cs b/samples/EShopSample/aspnet-core/src/EShopSample.Domain/DefaultAccountGroup.cs
new file mode 100644
index 00000000..441b189e
--- /dev/null
+++ b/samples/EShopSample/aspnet-core/src/EShopSample.Domain/DefaultAccountGroup.cs
@@ -0,0 +1,10 @@
+using EasyAbp.PaymentService.Prepayment.Options.AccountGroups;
+
+namespace EShopSample
+{
+ [AccountGroupName("default")]
+ public class DefaultAccountGroup
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/samples/EShopSample/aspnet-core/src/EShopSample.Domain/EShopSample.Domain.csproj b/samples/EShopSample/aspnet-core/src/EShopSample.Domain/EShopSample.Domain.csproj
index 807124fc..085e57e5 100644
--- a/samples/EShopSample/aspnet-core/src/EShopSample.Domain/EShopSample.Domain.csproj
+++ b/samples/EShopSample/aspnet-core/src/EShopSample.Domain/EShopSample.Domain.csproj
@@ -14,8 +14,9 @@
-
-
+
+
+
@@ -28,12 +29,4 @@
-
-
-
-
-
-
-
-
diff --git a/samples/EShopSample/aspnet-core/src/EShopSample.Domain/EShopSampleDomainModule.cs b/samples/EShopSample/aspnet-core/src/EShopSample.Domain/EShopSampleDomainModule.cs
index 5b18d5cf..41a96b66 100644
--- a/samples/EShopSample/aspnet-core/src/EShopSample.Domain/EShopSampleDomainModule.cs
+++ b/samples/EShopSample/aspnet-core/src/EShopSample.Domain/EShopSampleDomainModule.cs
@@ -2,6 +2,9 @@
using EasyAbp.EShop.Plugins.Baskets;
using EasyAbp.PaymentService;
using EasyAbp.PaymentService.Payments;
+using EasyAbp.PaymentService.Prepayment;
+using EasyAbp.PaymentService.Prepayment.Options;
+using EasyAbp.PaymentService.Prepayment.PaymentService;
using EasyAbp.PaymentService.WeChatPay;
using EShopSample.MultiTenancy;
using EShopSample.ObjectExtending;
@@ -35,7 +38,8 @@ namespace EShopSample
typeof(EShopDomainModule),
typeof(EShopPluginsBasketsDomainModule),
typeof(PaymentServiceDomainModule),
- typeof(PaymentServiceWeChatPayDomainModule)
+ typeof(PaymentServiceWeChatPayDomainModule),
+ typeof(PaymentServicePrepaymentDomainModule)
)]
public class EShopSampleDomainModule : AbpModule
{
@@ -50,6 +54,8 @@ namespace EShopSample
{
options.IsEnabled = MultiTenancyConsts.IsEnabled;
});
+
+ ConfigurePaymentServicePrepayment();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
@@ -58,6 +64,18 @@ namespace EShopSample
resolver.TryRegisterProvider(FreePaymentServiceProvider.PaymentMethod, typeof(FreePaymentServiceProvider));
resolver.TryRegisterProvider(WeChatPayPaymentServiceProvider.PaymentMethod, typeof(WeChatPayPaymentServiceProvider));
+ resolver.TryRegisterProvider(PrepaymentPaymentServiceProvider.PaymentMethod, typeof(PrepaymentPaymentServiceProvider));
+ }
+
+ private void ConfigurePaymentServicePrepayment()
+ {
+ Configure(options =>
+ {
+ options.AccountGroups.Configure(accountGroup =>
+ {
+ accountGroup.Currency = "CNY";
+ });
+ });
}
}
}
diff --git a/samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EShopSampleMigrationsDbContext.cs b/samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EShopSampleMigrationsDbContext.cs
index d54eb68e..0b5afce5 100644
--- a/samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EShopSampleMigrationsDbContext.cs
+++ b/samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EShopSampleMigrationsDbContext.cs
@@ -1,6 +1,7 @@
using EasyAbp.EShop.EntityFrameworkCore;
using EasyAbp.EShop.Plugins.Baskets.EntityFrameworkCore;
using EasyAbp.PaymentService.EntityFrameworkCore;
+using EasyAbp.PaymentService.Prepayment.EntityFrameworkCore;
using EasyAbp.PaymentService.WeChatPay.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
@@ -53,6 +54,7 @@ namespace EShopSample.EntityFrameworkCore
builder.ConfigurePaymentService();
builder.ConfigurePaymentServiceWeChatPay();
+ builder.ConfigurePaymentServicePrepayment();
}
}
}
\ No newline at end of file
diff --git a/samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200826141904_AddedPrepaymentModule.Designer.cs b/samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200826141904_AddedPrepaymentModule.Designer.cs
new file mode 100644
index 00000000..b86b4e6b
--- /dev/null
+++ b/samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200826141904_AddedPrepaymentModule.Designer.cs
@@ -0,0 +1,4183 @@
+//
+using System;
+using EShopSample.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Volo.Abp.EntityFrameworkCore;
+
+namespace EShopSample.Migrations
+{
+ [DbContext(typeof(EShopSampleMigrationsDbContext))]
+ [Migration("20200826141904_AddedPrepaymentModule")]
+ partial class AddedPrepaymentModule
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
+ .HasAnnotation("ProductVersion", "3.1.5")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128)
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("EasyAbp.EShop.Orders.Orders.Order", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("CanceledTime")
+ .HasColumnType("datetime2");
+
+ b.Property("CancellationReason")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("CompletionTime")
+ .HasColumnType("datetime2");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnName("ConcurrencyStamp")
+ .HasColumnType("nvarchar(40)")
+ .HasMaxLength(40);
+
+ b.Property("CreationTime")
+ .HasColumnName("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatorId")
+ .HasColumnName("CreatorId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Currency")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("CustomerRemark")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("CustomerUserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DeleterId")
+ .HasColumnName("DeleterId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DeletionTime")
+ .HasColumnName("DeletionTime")
+ .HasColumnType("datetime2");
+
+ b.Property("ExtraProperties")
+ .HasColumnName("ExtraProperties")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnName("IsDeleted")
+ .HasColumnType("bit")
+ .HasDefaultValue(false);
+
+ b.Property("LastModificationTime")
+ .HasColumnName("LastModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifierId")
+ .HasColumnName("LastModifierId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("OrderNumber")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("OrderStatus")
+ .HasColumnType("int");
+
+ b.Property("PaidTime")
+ .HasColumnType("datetime2");
+
+ b.Property("PaymentId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ProductTotalPrice")
+ .HasColumnType("decimal(20,8)");
+
+ b.Property("ReducedInventoryAfterPaymentTime")
+ .HasColumnType("datetime2");
+
+ b.Property("ReducedInventoryAfterPlacingTime")
+ .HasColumnType("datetime2");
+
+ b.Property("RefundAmount")
+ .HasColumnType("decimal(20,8)");
+
+ b.Property("StaffRemark")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("StoreId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("TenantId")
+ .HasColumnName("TenantId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("TotalDiscount")
+ .HasColumnType("decimal(20,8)");
+
+ b.Property("TotalPrice")
+ .HasColumnType("decimal(20,8)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("OrderNumber")
+ .IsUnique()
+ .HasFilter("[OrderNumber] IS NOT NULL");
+
+ b.ToTable("EasyAbpEShopOrdersOrders");
+ });
+
+ modelBuilder.Entity("EasyAbp.EShop.Orders.Orders.OrderLine", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("CreationTime")
+ .HasColumnName("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatorId")
+ .HasColumnName("CreatorId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Currency")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DeleterId")
+ .HasColumnName("DeleterId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DeletionTime")
+ .HasColumnName("DeletionTime")
+ .HasColumnType("datetime2");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnName("IsDeleted")
+ .HasColumnType("bit")
+ .HasDefaultValue(false);
+
+ b.Property("LastModificationTime")
+ .HasColumnName("LastModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifierId")
+ .HasColumnName("LastModifierId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("MediaResources")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("OrderId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ProductDetailModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("ProductDisplayName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ProductId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ProductModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("ProductSkuId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ProductTypeUniqueName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ProductUniqueName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Quantity")
+ .HasColumnType("int");
+
+ b.Property("RefundAmount")
+ .HasColumnType("decimal(20,8)");
+
+ b.Property("RefundedQuantity")
+ .HasColumnType("int");
+
+ b.Property("SkuDescription")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("SkuName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TotalDiscount")
+ .HasColumnType("decimal(20,8)");
+
+ b.Property("TotalPrice")
+ .HasColumnType("decimal(20,8)");
+
+ b.Property("UnitPrice")
+ .HasColumnType("decimal(20,8)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("OrderId");
+
+ b.ToTable("EasyAbpEShopOrdersOrderLines");
+ });
+
+ modelBuilder.Entity("EasyAbp.EShop.Payments.Payments.Payment", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ActualPaymentAmount")
+ .HasColumnType("decimal(20,8)");
+
+ b.Property("CanceledTime")
+ .HasColumnType("datetime2");
+
+ b.Property("CompletionTime")
+ .HasColumnType("datetime2");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnName("ConcurrencyStamp")
+ .HasColumnType("nvarchar(40)")
+ .HasMaxLength(40);
+
+ b.Property("CreationTime")
+ .HasColumnName("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatorId")
+ .HasColumnName("CreatorId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Currency")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DeleterId")
+ .HasColumnName("DeleterId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DeletionTime")
+ .HasColumnName("DeletionTime")
+ .HasColumnType("datetime2");
+
+ b.Property("ExternalTradingCode")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ExtraProperties")
+ .HasColumnName("ExtraProperties")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnName("IsDeleted")
+ .HasColumnType("bit")
+ .HasDefaultValue(false);
+
+ b.Property("LastModificationTime")
+ .HasColumnName("LastModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifierId")
+ .HasColumnName("LastModifierId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("OriginalPaymentAmount")
+ .HasColumnType("decimal(20,8)");
+
+ b.Property("PayeeAccount")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PaymentDiscount")
+ .HasColumnType("decimal(20,8)");
+
+ b.Property("PaymentMethod")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PendingRefundAmount")
+ .HasColumnType("decimal(20,8)");
+
+ b.Property("RefundAmount")
+ .HasColumnType("decimal(20,8)");
+
+ b.Property("TenantId")
+ .HasColumnName("TenantId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("UserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.ToTable("EasyAbpEShopPaymentsPayments");
+ });
+
+ modelBuilder.Entity("EasyAbp.EShop.Payments.Payments.PaymentItem", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ActualPaymentAmount")
+ .HasColumnType("decimal(20,8)");
+
+ b.Property("CreationTime")
+ .HasColumnName("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatorId")
+ .HasColumnName("CreatorId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Currency")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DeleterId")
+ .HasColumnName("DeleterId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DeletionTime")
+ .HasColumnName("DeletionTime")
+ .HasColumnType("datetime2");
+
+ b.Property("ExtraProperties")
+ .HasColumnName("ExtraProperties")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnName("IsDeleted")
+ .HasColumnType("bit")
+ .HasDefaultValue(false);
+
+ b.Property("ItemKey")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ItemType")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("LastModificationTime")
+ .HasColumnName("LastModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifierId")
+ .HasColumnName("LastModifierId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("OriginalPaymentAmount")
+ .HasColumnType("decimal(20,8)");
+
+ b.Property("PaymentDiscount")
+ .HasColumnType("decimal(20,8)");
+
+ b.Property("PaymentId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("PendingRefundAmount")
+ .HasColumnType("decimal(20,8)");
+
+ b.Property("RefundAmount")
+ .HasColumnType("decimal(20,8)");
+
+ b.Property("StoreId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("PaymentId");
+
+ b.ToTable("EasyAbpEShopPaymentsPaymentItems");
+ });
+
+ modelBuilder.Entity("EasyAbp.EShop.Payments.Refunds.Refund", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("CanceledTime")
+ .HasColumnType("datetime2");
+
+ b.Property("CompletedTime")
+ .HasColumnType("datetime2");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnName("ConcurrencyStamp")
+ .HasColumnType("nvarchar(40)")
+ .HasMaxLength(40);
+
+ b.Property("CreationTime")
+ .HasColumnName("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatorId")
+ .HasColumnName("CreatorId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Currency")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("CustomerRemark")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DeleterId")
+ .HasColumnName("DeleterId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DeletionTime")
+ .HasColumnName("DeletionTime")
+ .HasColumnType("datetime2");
+
+ b.Property("DisplayReason")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ExternalTradingCode")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ExtraProperties")
+ .HasColumnName("ExtraProperties")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnName("IsDeleted")
+ .HasColumnType("bit")
+ .HasDefaultValue(false);
+
+ b.Property("LastModificationTime")
+ .HasColumnName("LastModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifierId")
+ .HasColumnName("LastModifierId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("PaymentId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("RefundAmount")
+ .HasColumnType("decimal(20,8)");
+
+ b.Property("RefundPaymentMethod")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("StaffRemark")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TenantId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.ToTable("EasyAbpEShopPaymentsRefunds");
+ });
+
+ modelBuilder.Entity("EasyAbp.EShop.Payments.Refunds.RefundItem", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("CreationTime")
+ .HasColumnName("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatorId")
+ .HasColumnName("CreatorId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("CustomerRemark")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DeleterId")
+ .HasColumnName("DeleterId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DeletionTime")
+ .HasColumnName("DeletionTime")
+ .HasColumnType("datetime2");
+
+ b.Property("ExtraProperties")
+ .HasColumnName("ExtraProperties")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnName("IsDeleted")
+ .HasColumnType("bit")
+ .HasDefaultValue(false);
+
+ b.Property("LastModificationTime")
+ .HasColumnName("LastModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifierId")
+ .HasColumnName("LastModifierId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("OrderId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("PaymentItemId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("RefundAmount")
+ .HasColumnType("decimal(20,8)");
+
+ b.Property("RefundId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("StaffRemark")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("StoreId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RefundId");
+
+ b.ToTable("EasyAbpEShopPaymentsRefundItems");
+ });
+
+ modelBuilder.Entity("EasyAbp.EShop.Payments.Refunds.RefundItemOrderLine", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("OrderLineId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("RefundAmount")
+ .HasColumnType("decimal(20,8)");
+
+ b.Property("RefundItemId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("RefundedQuantity")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RefundItemId");
+
+ b.ToTable("EasyAbpEShopPaymentsRefundItemOrderLines");
+ });
+
+ modelBuilder.Entity("EasyAbp.EShop.Plugins.Baskets.BasketItems.BasketItem", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("BasketName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnName("ConcurrencyStamp")
+ .HasColumnType("nvarchar(40)")
+ .HasMaxLength(40);
+
+ b.Property("CreationTime")
+ .HasColumnName("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatorId")
+ .HasColumnName("CreatorId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Currency")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ExtraProperties")
+ .HasColumnName("ExtraProperties")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Inventory")
+ .HasColumnType("int");
+
+ b.Property("IsInvalid")
+ .HasColumnType("bit");
+
+ b.Property("LastModificationTime")
+ .HasColumnName("LastModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifierId")
+ .HasColumnName("LastModifierId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("MediaResources")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ProductDisplayName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ProductId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ProductSkuId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ProductUniqueName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Quantity")
+ .HasColumnType("int");
+
+ b.Property("SkuDescription")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("SkuName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("StoreId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("TenantId")
+ .HasColumnName("TenantId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("TotalDiscount")
+ .HasColumnType("decimal(20,8)");
+
+ b.Property("TotalPrice")
+ .HasColumnType("decimal(20,8)");
+
+ b.Property("UnitPrice")
+ .HasColumnType("decimal(20,8)");
+
+ b.Property("UserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("EasyAbpEShopPluginsBasketsBasketItems");
+ });
+
+ modelBuilder.Entity("EasyAbp.EShop.Plugins.Baskets.ProductUpdates.ProductUpdate", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnName("ConcurrencyStamp")
+ .HasColumnType("nvarchar(40)")
+ .HasMaxLength(40);
+
+ b.Property("CreationTime")
+ .HasColumnName("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatorId")
+ .HasColumnName("CreatorId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DeleterId")
+ .HasColumnName("DeleterId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DeletionTime")
+ .HasColumnName("DeletionTime")
+ .HasColumnType("datetime2");
+
+ b.Property("ExtraProperties")
+ .HasColumnName("ExtraProperties")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnName("IsDeleted")
+ .HasColumnType("bit")
+ .HasDefaultValue(false);
+
+ b.Property("LastModificationTime")
+ .HasColumnName("LastModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifierId")
+ .HasColumnName("LastModifierId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ProductSkuId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ProductSkuId");
+
+ b.ToTable("EasyAbpEShopPluginsBasketsProductUpdates");
+ });
+
+ modelBuilder.Entity("EasyAbp.EShop.Products.Categories.Category", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Code")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnName("ConcurrencyStamp")
+ .HasColumnType("nvarchar(40)")
+ .HasMaxLength(40);
+
+ b.Property("CreationTime")
+ .HasColumnName("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatorId")
+ .HasColumnName("CreatorId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DeleterId")
+ .HasColumnName("DeleterId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DeletionTime")
+ .HasColumnName("DeletionTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DisplayName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ExtraProperties")
+ .HasColumnName("ExtraProperties")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnName("IsDeleted")
+ .HasColumnType("bit")
+ .HasDefaultValue(false);
+
+ b.Property("IsHidden")
+ .HasColumnType("bit");
+
+ b.Property("LastModificationTime")
+ .HasColumnName("LastModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifierId")
+ .HasColumnName("LastModifierId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Level")
+ .HasColumnType("int");
+
+ b.Property("MediaResources")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ParentId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("TenantId")
+ .HasColumnName("TenantId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("UniqueName")
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ParentId");
+
+ b.HasIndex("UniqueName")
+ .IsUnique()
+ .HasFilter("[UniqueName] IS NOT NULL");
+
+ b.ToTable("EasyAbpEShopProductsCategories");
+ });
+
+ modelBuilder.Entity("EasyAbp.EShop.Products.ProductCategories.ProductCategory", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("CategoryId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnName("ConcurrencyStamp")
+ .HasColumnType("nvarchar(40)")
+ .HasMaxLength(40);
+
+ b.Property("CreationTime")
+ .HasColumnName("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatorId")
+ .HasColumnName("CreatorId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DisplayOrder")
+ .HasColumnType("int");
+
+ b.Property("ExtraProperties")
+ .HasColumnName("ExtraProperties")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("LastModificationTime")
+ .HasColumnName("LastModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifierId")
+ .HasColumnName("LastModifierId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ProductId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("TenantId")
+ .HasColumnName("TenantId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.ToTable("EasyAbpEShopProductsProductCategories");
+ });
+
+ modelBuilder.Entity("EasyAbp.EShop.Products.ProductDetailHistories.ProductDetailHistory", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnName("ConcurrencyStamp")
+ .HasColumnType("nvarchar(40)")
+ .HasMaxLength(40);
+
+ b.Property("ExtraProperties")
+ .HasColumnName("ExtraProperties")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("ProductDetailId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("SerializedEntityData")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ModificationTime");
+
+ b.HasIndex("ProductDetailId");
+
+ b.ToTable("EasyAbpEShopProductsProductDetailHistories");
+ });
+
+ modelBuilder.Entity("EasyAbp.EShop.Products.ProductDetails.ProductDetail", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnName("ConcurrencyStamp")
+ .HasColumnType("nvarchar(40)")
+ .HasMaxLength(40);
+
+ b.Property("CreationTime")
+ .HasColumnName("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatorId")
+ .HasColumnName("CreatorId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DeleterId")
+ .HasColumnName("DeleterId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DeletionTime")
+ .HasColumnName("DeletionTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ExtraProperties")
+ .HasColumnName("ExtraProperties")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnName("IsDeleted")
+ .HasColumnType("bit")
+ .HasDefaultValue(false);
+
+ b.Property("LastModificationTime")
+ .HasColumnName("LastModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifierId")
+ .HasColumnName("LastModifierId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.ToTable("EasyAbpEShopProductsProductDetails");
+ });
+
+ modelBuilder.Entity("EasyAbp.EShop.Products.ProductHistories.ProductHistory", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnName("ConcurrencyStamp")
+ .HasColumnType("nvarchar(40)")
+ .HasMaxLength(40);
+
+ b.Property("ExtraProperties")
+ .HasColumnName("ExtraProperties")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("ProductId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("SerializedEntityData")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ModificationTime");
+
+ b.HasIndex("ProductId");
+
+ b.ToTable("EasyAbpEShopProductsProductHistories");
+ });
+
+ modelBuilder.Entity("EasyAbp.EShop.Products.ProductInventories.ProductInventory", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnName("ConcurrencyStamp")
+ .HasColumnType("nvarchar(40)")
+ .HasMaxLength(40);
+
+ b.Property("CreationTime")
+ .HasColumnName("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatorId")
+ .HasColumnName("CreatorId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DeleterId")
+ .HasColumnName("DeleterId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DeletionTime")
+ .HasColumnName("DeletionTime")
+ .HasColumnType("datetime2");
+
+ b.Property("ExtraProperties")
+ .HasColumnName("ExtraProperties")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Inventory")
+ .HasColumnType("int");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnName("IsDeleted")
+ .HasColumnType("bit")
+ .HasDefaultValue(false);
+
+ b.Property("LastModificationTime")
+ .HasColumnName("LastModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifierId")
+ .HasColumnName("LastModifierId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ProductId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ProductSkuId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Sold")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ProductSkuId");
+
+ b.ToTable("EasyAbpEShopProductsProductInventories");
+ });
+
+ modelBuilder.Entity("EasyAbp.EShop.Products.ProductStores.ProductStore", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnName("ConcurrencyStamp")
+ .HasColumnType("nvarchar(40)")
+ .HasMaxLength(40);
+
+ b.Property("CreationTime")
+ .HasColumnName("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatorId")
+ .HasColumnName("CreatorId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DeleterId")
+ .HasColumnName("DeleterId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DeletionTime")
+ .HasColumnName("DeletionTime")
+ .HasColumnType("datetime2");
+
+ b.Property("ExtraProperties")
+ .HasColumnName("ExtraProperties")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnName("IsDeleted")
+ .HasColumnType("bit")
+ .HasDefaultValue(false);
+
+ b.Property("IsOwner")
+ .HasColumnType("bit");
+
+ b.Property("LastModificationTime")
+ .HasColumnName("LastModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property