Browse Source

Merge branch 'dev' into ProductTagAndStoreOwner

pull/81/head
RayMMond 6 years ago
parent
commit
d6dd179253
  1. 88
      azure-pipelines.yml
  2. 2
      common.props
  3. 1
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp.EShop.Orders.Domain.csproj
  4. 4
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/EShopOrdersDomainModule.cs
  5. 2
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/BasicOrderCompletableCheckProvider.cs
  6. 2
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderCompletableCheckProvider.cs
  7. 4
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderPaymentChecker.cs
  8. 11
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderPaymentCompletedEventHandler.cs
  9. 11
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderPaymentCreatedEventHandler.cs
  10. 10
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IPaymentCompletedEventHandler.cs
  11. 11
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IPaymentCreatedEventHandler.cs
  12. 2
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IProductInventoryReductionEventHandler.cs
  13. 4
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidPaymentException.cs
  14. 2
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderLine.cs
  15. 2
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderManager.cs
  16. 10
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderPaymentChecker.cs
  17. 35
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/PaymentCanceledEventHandler.cs
  18. 18
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/PaymentCompletedEventHandler.cs
  19. 10
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/PaymentCreatedEventHandler.cs
  20. 4
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/ProductInventoryReductionEventHandler.cs
  21. 15
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/RefundCompletedEventHandler.cs
  22. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp.EShop.Payments.Application.Contracts.csproj
  23. 6
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/Dtos/PaymentDto.cs
  24. 8
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/Dtos/PaymentItemDto.cs
  25. 4
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/PaymentAlreadyExistsException.cs
  26. 4
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Refunds/Dtos/RefundDto.cs
  27. 33
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Refunds/Dtos/RefundItemDto.cs
  28. 14
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Refunds/Dtos/RefundItemOrderLineDto.cs
  29. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/BasicPayableCheckProvider.cs
  30. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/PaymentAppService.cs
  31. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/PaymentsApplicationAutoMapperProfile.cs
  32. 13
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/OrderIsNotInSpecifiedPaymentException.cs
  33. 11
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/RefundAppService.cs
  34. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp.EShop.Payments.Domain.Shared.csproj
  35. 10
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Payments/EShopPaymentCanceledEto.cs
  36. 10
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Payments/EShopPaymentCompletedEto.cs
  37. 48
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Payments/EShopPaymentEto.cs
  38. 35
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Payments/EShopPaymentItemEto.cs
  39. 7
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Refunds/EShopRefundCompletedEto.cs
  40. 8
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/EShopPaymentsDomainModule.cs
  41. 5
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Payments/PaymentItem.cs
  42. 152
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Payments/PaymentSynchronizer.cs
  43. 9
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/PaymentsDomainAutoMapperProfile.cs
  44. 6
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Refunds/Refund.cs
  45. 4
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Refunds/RefundItem.cs
  46. 159
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Refunds/RefundSynchronizer.cs
  47. 6
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.EntityFrameworkCore/EasyAbp/EShop/Payments/Refunds/RefundRepository.cs
  48. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/CreateUpdateProductDto.cs
  49. 5
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/CreateUpdateProductSkuDto.cs
  50. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/ProductDto.cs
  51. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/ProductSkuDto.cs
  52. 68
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/ProductAppService.cs
  53. 1
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductsApplicationAutoMapperProfile.cs
  54. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/cs.json
  55. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/en.json
  56. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/pl.json
  57. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/pt-BR.json
  58. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/sl.json
  59. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/tr.json
  60. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/vi.json
  61. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/zh-Hans.json
  62. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/zh-Hant.json
  63. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/DefaultProductInventoryProvider.cs
  64. 14
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/DefaultProductPriceProvider.cs
  65. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductInventoryProvider.cs
  66. 4
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductManager.cs
  67. 10
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductPriceProvider.cs
  68. 7
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/OrderCreatedEventHandler.cs
  69. 7
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/OrderPaidEventHandler.cs
  70. 9
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/PriceDataModel.cs
  71. 5
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/Product.cs
  72. 50
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductManager.cs
  73. 7
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductSku.cs
  74. 4
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/ViewModels/CreateEditProductViewModel.cs
  75. 4
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/ProductSku/ViewModels/EditProductSkuViewModel.cs
  76. 5
      samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSample.Application.Contracts.csproj
  77. 4
      samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSampleApplicationContractsModule.cs
  78. 5
      samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSample.Application.csproj
  79. 4
      samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSampleApplicationModule.cs
  80. 3
      samples/EShopSample/aspnet-core/src/EShopSample.DbMigrator/appsettings.json
  81. 5
      samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSample.Domain.Shared.csproj
  82. 4
      samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSampleDomainSharedModule.cs
  83. 10
      samples/EShopSample/aspnet-core/src/EShopSample.Domain/DefaultAccountGroup.cs
  84. 13
      samples/EShopSample/aspnet-core/src/EShopSample.Domain/EShopSample.Domain.csproj
  85. 20
      samples/EShopSample/aspnet-core/src/EShopSample.Domain/EShopSampleDomainModule.cs
  86. 2
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EShopSampleMigrationsDbContext.cs
  87. 4183
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200826141904_AddedPrepaymentModule.Designer.cs
  88. 86
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200826141904_AddedPrepaymentModule.cs
  89. 4180
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200826214249_RemovedCurrencyFromPaymentItem.Designer.cs
  90. 23
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200826214249_RemovedCurrencyFromPaymentItem.cs
  91. 4174
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200828083149_RemovedSpecifiedInventoryProviderName.Designer.cs
  92. 33
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200828083149_RemovedSpecifiedInventoryProviderName.cs
  93. 145
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/EShopSampleMigrationsDbContextModelSnapshot.cs
  94. 5
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore/EShopSample.EntityFrameworkCore.csproj
  95. 4
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore/EntityFrameworkCore/EShopSampleEntityFrameworkCoreModule.cs
  96. 5
      samples/EShopSample/aspnet-core/src/EShopSample.HttpApi.Client/EShopSample.HttpApi.Client.csproj
  97. 4
      samples/EShopSample/aspnet-core/src/EShopSample.HttpApi.Client/EShopSampleHttpApiClientModule.cs
  98. 5
      samples/EShopSample/aspnet-core/src/EShopSample.HttpApi/EShopSample.HttpApi.csproj
  99. 4
      samples/EShopSample/aspnet-core/src/EShopSample.HttpApi/EShopSampleHttpApiModule.cs
  100. 5
      samples/EShopSample/aspnet-core/src/EShopSample.Web/EShopSample.Web.csproj

88
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'

2
common.props

@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>0.10.0</Version>
<Version>0.12.0</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>EasyAbp Team</Authors>

1
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp.EShop.Orders.Domain.csproj

@ -8,7 +8,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EasyAbp.PaymentService.Domain.Shared" Version="1.1.4" />
<PackageReference Include="Volo.Abp.AutoMapper" Version="3.0.5" />
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="3.0.5" />
<ProjectReference Include="..\..\..\EasyAbp.EShop.Payments\src\EasyAbp.EShop.Payments.Domain.Shared\EasyAbp.EShop.Payments.Domain.Shared.csproj" />

4
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

2
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/BasicCompletableCheckProvider.cs → 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)
{

2
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/ICompletableCheckProvider.cs → 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);
}

4
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<bool> IsValidPaymentAsync(Order order, PaymentEto payment, PaymentItemEto paymentItem);
Task<bool> IsValidPaymentAsync(Order order, EShopPaymentEto payment, EShopPaymentItemEto paymentItem);
}
}

11
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderPaymentCompletedEventHandler.cs

@ -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<PaymentCompletedEto>
{
}
}

11
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderPaymentCreatedEventHandler.cs

@ -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<EntityCreatedEto<PaymentEto>>
{
}
}

10
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<EShopPaymentCompletedEto>
{
}
}

11
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<EntityCreatedEto<EShopPaymentEto>>
{
}
}

2
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderProductInventoryReductionEventHandler.cs → 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<ProductInventoryReductionAfterOrderPlacedResultEto>,
IDistributedEventHandler<ProductInventoryReductionAfterOrderPaidResultEto>
{

4
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderPaymentInvalidException.cs → 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}.")
{
}

2
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;
}
}

2
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<ICompletableCheckProvider>();
var providers = ServiceProvider.GetServices<IOrderCompletableCheckProvider>();
foreach (var provider in providers)
{

10
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<bool> IsValidPaymentAsync(Order order, PaymentEto payment, PaymentItemEto paymentItem)
public virtual async Task<bool> IsValidPaymentAsync(Order order, EShopPaymentEto payment, EShopPaymentItemEto paymentItem)
{
return await IsStoreIdCorrectAsync(order, paymentItem) &&
await IsPaymentPriceCorrectAsync(order, paymentItem) &&
await IsUserAllowedToPayAsync(order, payment);
}
protected virtual Task<bool> IsStoreIdCorrectAsync(Order order, PaymentItemEto paymentItem)
protected virtual Task<bool> IsStoreIdCorrectAsync(Order order, EShopPaymentItemEto paymentItem)
{
return Task.FromResult(
Guid.TryParse(paymentItem.GetProperty<string>("StoreId"), out var paymentStoreId) &&
order.StoreId == paymentStoreId);
}
protected virtual Task<bool> IsPaymentPriceCorrectAsync(Order order, PaymentItemEto paymentItem)
protected virtual Task<bool> IsPaymentPriceCorrectAsync(Order order, EShopPaymentItemEto paymentItem)
{
return Task.FromResult(order.TotalPrice == paymentItem.OriginalPaymentAmount);
}
protected virtual Task<bool> IsUserAllowedToPayAsync(Order order, PaymentEto payment)
protected virtual Task<bool> IsUserAllowedToPayAsync(Order order, EShopPaymentEto payment)
{
return Task.FromResult(order.CustomerUserId == payment.UserId);
}

35
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<EShopPaymentCanceledEto>, 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);
}
}
}
}

18
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderPaymentCompletedEventHandler.cs → 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, OrderEto>(order),
PaymentId = payment.Id,
@ -84,7 +82,7 @@ namespace EasyAbp.EShop.Orders.Orders
}));
}
await uow.CompleteAsync();
await _unitOfWorkManager.Current.CompleteAsync();
}
}
}

10
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderPaymentCreatedEventHandler.cs → 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<PaymentEto> eventData)
public virtual async Task HandleEventAsync(EntityCreatedEto<EShopPaymentEto> 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);

4
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderProductInventoryReductionEventHandler.cs → 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)

15
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderRefundEventHandler.cs → 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<EntityCreatedEto<EShopRefundEto>>, ITransientDependency
public class RefundCompletedEventHandler : IDistributedEventHandler<EShopRefundCompletedEto>, 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<EShopRefundEto> 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);

2
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp.EShop.Payments.Application.Contracts.csproj

@ -8,9 +8,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EasyAbp.PaymentService.Domain.Shared" Version="1.1.7" />
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" Version="3.0.5" />
<PackageReference Include="Volo.Abp.Authorization" Version="3.0.5" />
<PackageReference Include="EasyAbp.PaymentService.Domain.Shared" Version="1.1.4" />
<ProjectReference Include="..\EasyAbp.EShop.Payments.Domain.Shared\EasyAbp.EShop.Payments.Domain.Shared.csproj" />
</ItemGroup>

6
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<Guid>, 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<PaymentItemDto> PaymentItems { get; set; }
}
}

8
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<Guid>, 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; }
}
}

4
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/OrderPaymentAlreadyExistsException.cs → 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.")
{
}

4
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<Guid>, 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<RefundItemDto> RefundItems { get; set; }
}
}

33
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<Guid>, IRefund
public class RefundItemDto : ExtensibleFullAuditedEntityDto<Guid>, 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<RefundItemOrderLineDto> RefundItemOrderLines { get; set; }
}
}

14
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; }
}
}

2
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)

2
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<string, object> {{"StoreId", orders.First().StoreId.ToString()}}
ExtraProperties = new Dictionary<string, object> {{"StoreId", order.StoreId.ToString()}}
}).ToList()
};

2
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/PaymentsApplicationAutoMapperProfile.cs

@ -16,6 +16,8 @@ namespace EasyAbp.EShop.Payments
CreateMap<Payment, PaymentDto>();
CreateMap<PaymentItem, PaymentItemDto>();
CreateMap<Refund, RefundDto>();
CreateMap<RefundItem, RefundItemDto>();
CreateMap<RefundItemOrderLine, RefundItemOrderLineDto>();
}
}
}

13
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}).")
{
}
}
}

11
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,

2
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp.EShop.Payments.Domain.Shared.csproj

@ -10,7 +10,7 @@
<ItemGroup>
<PackageReference Include="Volo.Abp.Validation" Version="3.0.5" />
<PackageReference Include="EasyAbp.PaymentService.Domain.Shared" Version="1.1.4" />
<PackageReference Include="EasyAbp.PaymentService.Domain.Shared" Version="1.1.7" />
</ItemGroup>
<ItemGroup>

10
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; }
}
}

10
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; }
}
}

48
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<string, object> ExtraProperties { get; set; }
#endregion
public List<EShopPaymentItemEto> PaymentItems { get; set; } = new List<EShopPaymentItemEto>();
}
}

35
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<string, object> ExtraProperties { get; set; }
#endregion
public Guid StoreId { get; set; }
}
}

7
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; }
}
}

8
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<AbpDistributedEntityEventOptions>(options =>
{
options.EtoMappings.Add<Refund, RefundEto>(typeof(EShopPaymentsDomainModule));
options.EtoMappings.Add<Payment, EShopPaymentEto>(typeof(EShopPaymentsDomainModule));
options.EtoMappings.Add<Refund, EShopRefundEto>(typeof(EShopPaymentsDomainModule));
options.AutoEventSelectors.Add<Payment>();
options.AutoEventSelectors.Add<Refund>();
});
}

5
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; }

152
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<EntityCreatedEto<PaymentEto>>,
IDistributedEventHandler<EntityUpdatedEto<PaymentEto>>,
IDistributedEventHandler<EntityDeletedEto<PaymentEto>>,
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<PaymentEto> eventData)
public virtual async Task HandleEventAsync(EntityCreatedEto<PaymentEto> 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<PaymentEto, Payment>(eventData.Entity);
return;
}
payment = _objectMapper.Map<PaymentEto, Payment>(eventData.Entity);
payment.SetPaymentItems(
_objectMapper.Map<List<PaymentItemEto>, List<PaymentItem>>(eventData.Entity.PaymentItems));
payment.PaymentItems.ForEach(FillPaymentItemStoreId);
payment.SetPaymentItems(
_objectMapper.Map<List<PaymentItemEto>, List<PaymentItem>>(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, EShopPaymentEto>(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<string>("StoreId"), out var storeId))
{
throw new StoreIdNotFoundException();
}
item = _objectMapper.Map<PaymentItemEto, PaymentItem>(etoItem);
item.SetStoreId(storeId);
payment.PaymentItems.Add(item);
}
else
{
_objectMapper.Map(etoItem, item);
}
}
Payment = _objectMapper.Map<Payment, EShopPaymentEto>(payment)
});
});
}
[UnitOfWork(true)]
public virtual async Task HandleEventAsync(EntityUpdatedEto<PaymentEto> 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<PaymentItemEto, PaymentItem>(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<string>("StoreId"), out var storeId))
{
throw new StoreIdNotFoundException();
}
item.SetStoreId(storeId);
}
[UnitOfWork(true)]
public virtual async Task HandleEventAsync(EntityDeletedEto<PaymentEto> eventData)
{
using var changeTenant = _currentTenant.Change(eventData.Entity.TenantId);
var payment = await _paymentRepository.FindAsync(eventData.Entity.Id);
if (payment == null)

9
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/PaymentsDomainAutoMapperProfile.cs

@ -23,7 +23,14 @@ namespace EasyAbp.EShop.Payments
CreateMap<RefundEto, Refund>(MemberList.Source)
.Ignore(x => x.RefundItems);
CreateMap<RefundItemEto, RefundItem>(MemberList.Source)
.Ignore(x => x.StoreId);
.Ignore(x => x.StoreId)
.Ignore(x => x.OrderId);
CreateMap<Payment, EShopPaymentEto>();
CreateMap<PaymentItem, EShopPaymentItemEto>();
CreateMap<Refund, EShopRefundEto>();
CreateMap<RefundItem, EShopRefundItemEto>();
CreateMap<RefundItemOrderLine, RefundItemOrderLineEto>();
}
}
}

6
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<Guid>, IRefund
{
#region Base properties
@ -39,10 +37,10 @@ namespace EasyAbp.EShop.Payments.Refunds
public virtual DateTime? CanceledTime { get; protected set; }
public virtual List<RefundItem> RefundItems { get; protected set; }
#endregion
public virtual List<RefundItem> RefundItems { get; protected set; }
private Refund()
{

4
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<Guid>, IRefundItem, IMultiStore, IHasExtraProperties
{
#region Base properties

159
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<EntityUpdatedEto<EShopRefundEto>>,
IDistributedEventHandler<EntityDeletedEto<EShopRefundEto>>,
IDistributedEventHandler<EntityCreatedEto<RefundEto>>,
IDistributedEventHandler<EntityUpdatedEto<RefundEto>>,
IDistributedEventHandler<EntityDeletedEto<RefundEto>>,
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<RefundEto> 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<RefundEto, Refund>(eventData.Entity);
refund.SetRefundItems(
_objectMapper.Map<List<RefundItemEto>, List<RefundItem>>(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, EShopRefundEto>(refund)}));
}
}
[UnitOfWork(true)]
public virtual async Task HandleEventAsync(EntityUpdatedEto<EShopRefundEto> eventData)
public virtual async Task HandleEventAsync(EntityUpdatedEto<RefundEto> eventData)
{
using var changeTenant = _currentTenant.Change(eventData.Entity.TenantId);
var refund = await _refundRepository.FindAsync(eventData.Entity.Id);
if (refund == null)
{
refund = _objectMapper.Map<EShopRefundEto, Refund>(eventData.Entity);
refund.SetRefundItems(
_objectMapper.Map<List<EShopRefundItemEto>, List<RefundItem>>(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, EShopRefundEto>(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<string>("StoreId"), out var storeId))
{
throw new StoreIdNotFoundException();
}
if (!Guid.TryParse(etoItem.GetProperty<string>("OrderId"), out var orderId))
{
throw new OrderIdNotFoundException();
}
item = _objectMapper.Map<RefundItemEto, RefundItem>(etoItem);
item = _objectMapper.Map<EShopRefundItemEto, RefundItem>(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<EShopRefundEto> eventData)
protected virtual void FillRefundItemStoreId(RefundItem item)
{
if (!Guid.TryParse(item.GetProperty<string>("StoreId"), out var storeId))
{
throw new StoreIdNotFoundException();
}
item.SetStoreId(storeId);
}
protected virtual void FillRefundItemOrderId(RefundItem item)
{
if (!Guid.TryParse(item.GetProperty<string>("OrderId"), out var orderId))
{
throw new OrderIdNotFoundException();
}
item.SetOrderId(orderId);
}
[UnitOfWork(true)]
public virtual async Task HandleEventAsync(EntityDeletedEto<RefundEto> eventData)
{
using var changeTenant = _currentTenant.Change(eventData.Entity.TenantId);
var refund = await _refundRepository.FindAsync(eventData.Entity.Id);
if (refund == null)

6
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<Refund> WithDetails()
{
return base.WithDetails().Include(x => x.RefundItems);
}
public IQueryable<Refund> GetQueryableByUserId(Guid userId)
{
return from refund in DbContext.Refunds

3
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; }

5
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; }
}

2
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; }

2
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; }
}
}

68
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<ProductDto> 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<ProductDto> LoadDtoPriceAsync(Product product, ProductDto productDto, Guid storeId)
protected virtual async Task<ProductDto> 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<ProductDto> 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, ProductDto>(product);
var dto = MapToGetOutputDto(product);
await LoadDtoExtraDataAsync(product, dto, storeId);
await LoadDtosProductTypeUniqueNameAsync(new[] {dto});
return dto;
}
public async Task<ProductDto> 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, ProductDto>(product);
var dto = MapToGetOutputDto(product);
await LoadDtoExtraDataAsync(product, dto, storeId);
await LoadDtosProductTypeUniqueNameAsync(new[] {dto});
return dto;
}
public async Task<ProductDto> 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, ProductDto>(product);
var dto = MapToGetOutputDto(product);
await LoadDtoExtraDataAsync(product, dto, storeId);
await LoadDtosProductTypeUniqueNameAsync(new[] {dto});
return dto;
}
}
}

1
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductsApplicationAutoMapperProfile.cs

@ -39,6 +39,7 @@ namespace EasyAbp.EShop.Products
CreateMap<ProductSku, ProductSkuDto>()
.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)

3
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",

3
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",

3
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",

3
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",

3
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",

3
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",

3
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",

3
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",

3
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",

2
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;

14
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<decimal> GetPriceAsync(Product product, ProductSku productSku, Guid storeId)
{
return Task.FromResult(productSku.Price);
}
}
}

2
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<InventoryDataModel> GetInventoryDataAsync(Product product, ProductSku productSku, Guid storeId);
Task<Dictionary<Guid, InventoryDataModel>> GetInventoryDataDictionaryAsync(Product product, Guid storeId);

4
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<bool> TryIncreaseInventoryAsync(Product product, ProductSku productSku, Guid storeId, int quantity, bool reduceSold);
Task<bool> TryReduceInventoryAsync(Product product, ProductSku productSku, Guid storeId, int quantity, bool increaseSold);
Task<decimal> GetDiscountedPriceAsync(Product product, ProductSku productSku, Guid storeId);
Task<PriceDataModel> GetProductPriceAsync(Product product, ProductSku productSku, Guid storeId);
}
}

10
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<decimal> GetPriceAsync(Product product, ProductSku productSku, Guid storeId);
}
}

7
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<OrderEto> eventData)
{
using var changeTenant = _currentTenant.Change(eventData.Entity.TenantId);
using var uow = _unitOfWorkManager.Begin(isTransactional: true);
var models = new List<ConsumeInventoryModel>();
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);
}

7
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<ConsumeInventoryModel>();
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);
}

9
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; }
}
}

5
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<ProductAttribute>();

50
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<string, IProductInventoryProvider> 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<Product> CreateAsync(Product product, Guid? storeId = null,
@ -184,54 +185,43 @@ namespace EasyAbp.EShop.Products.Products
public virtual async Task<bool> 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<InventoryDataModel> 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<bool> 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<bool> 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<PriceDataModel> GetProductPriceAsync(Product product, ProductSku productSku, Guid storeId)
{
var providerName = !productSku.SpecifiedInventoryProviderName.IsNullOrWhiteSpace()
? productSku.SpecifiedInventoryProviderName
: !product.SpecifiedInventoryProviderName.IsNullOrWhiteSpace()
? product.SpecifiedInventoryProviderName
: "Default";
InventoryProviders ??= ServiceProvider.GetServices<IProductInventoryProvider>()
.ToDictionary(p => p.ProviderName, p => p);
return InventoryProviders.GetOrDefault(providerName) ?? InventoryProviders["Default"];
}
var price = await _productPriceProvider.GetPriceAsync(product, productSku, storeId);
public virtual async Task<decimal> GetDiscountedPriceAsync(Product product, ProductSku productSku, Guid storeId)
{
var currentPrice = productSku.Price;
var discountedPrice = price;
foreach (var provider in ServiceProvider.GetServices<IProductDiscountProvider>())
{
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
};
}
}
}

7
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;
}

4
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; }
}

4
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; }

5
samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSample.Application.Contracts.csproj

@ -14,8 +14,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="EasyAbp.PaymentService.Application.Contracts" Version="1.1.4" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.Application.Contracts" Version="1.1.4" />
<PackageReference Include="EasyAbp.PaymentService.Application.Contracts" Version="1.1.7" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.Application.Contracts" Version="1.1.7" />
<PackageReference Include="EasyAbp.PaymentService.Prepayment.Application.Contracts" Version="1.1.7" />
<PackageReference Include="Volo.Abp.ObjectExtending" Version="3.0.5" />
<PackageReference Include="Volo.Abp.Account.Application.Contracts" Version="3.0.5" />
<PackageReference Include="Volo.Abp.Identity.Application.Contracts" Version="3.0.5" />

4
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
{

5
samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSample.Application.csproj

@ -15,8 +15,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="EasyAbp.PaymentService.Application" Version="1.1.4" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.Application" Version="1.1.4" />
<PackageReference Include="EasyAbp.PaymentService.Application" Version="1.1.7" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.Application" Version="1.1.7" />
<PackageReference Include="EasyAbp.PaymentService.Prepayment.Application" Version="1.1.7" />
<PackageReference Include="Volo.Abp.Account.Application" Version="3.0.5" />
<PackageReference Include="Volo.Abp.Identity.Application" Version="3.0.5" />
<PackageReference Include="Volo.Abp.PermissionManagement.Application" Version="3.0.5" />

4
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
{

3
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": {

5
samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSample.Domain.Shared.csproj

@ -9,8 +9,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EasyAbp.PaymentService.Domain.Shared" Version="1.1.4" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.Domain.Shared" Version="1.1.4" />
<PackageReference Include="EasyAbp.PaymentService.Domain.Shared" Version="1.1.7" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.Domain.Shared" Version="1.1.7" />
<PackageReference Include="EasyAbp.PaymentService.Prepayment.Domain.Shared" Version="1.1.7" />
<PackageReference Include="Volo.Abp.Identity.Domain.Shared" Version="3.0.5" />
<PackageReference Include="Volo.Abp.IdentityServer.Domain.Shared" Version="3.0.5" />
<PackageReference Include="Volo.Abp.BackgroundJobs.Domain.Shared" Version="3.0.5" />

4
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
{

10
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
{
}
}

13
samples/EShopSample/aspnet-core/src/EShopSample.Domain/EShopSample.Domain.csproj

@ -14,8 +14,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="EasyAbp.PaymentService.Domain" Version="1.1.4" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.Domain" Version="1.1.4" />
<PackageReference Include="EasyAbp.PaymentService.Domain" Version="1.1.7" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.Domain" Version="1.1.7" />
<PackageReference Include="EasyAbp.PaymentService.Prepayment.Domain" Version="1.1.7" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.DataAnnotations" Version="2.2.0" />
<PackageReference Include="Volo.Abp.Identity.Domain" Version="3.0.5" />
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.Identity" Version="3.0.5" />
@ -28,12 +29,4 @@
<PackageReference Include="Volo.Abp.SettingManagement.Domain" Version="3.0.5" />
</ItemGroup>
<ItemGroup>
<Folder Include="EasyAbp\PaymentService\WeChatPay" />
</ItemGroup>
<ItemGroup>
<Compile Remove="EasyAbp\PaymentService\WeChatPay\TestPaymentOpenIdProvider.cs" />
</ItemGroup>
</Project>

20
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<PaymentServicePrepaymentOptions>(options =>
{
options.AccountGroups.Configure<DefaultAccountGroup>(accountGroup =>
{
accountGroup.Currency = "CNY";
});
});
}
}
}

2
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();
}
}
}

4183
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200826141904_AddedPrepaymentModule.Designer.cs

File diff suppressed because it is too large

86
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200826141904_AddedPrepaymentModule.cs

@ -0,0 +1,86 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace EShopSample.Migrations
{
public partial class AddedPrepaymentModule : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "EasyAbpPaymentServicePrepaymentAccounts",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ExtraProperties = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(nullable: false),
CreatorId = table.Column<Guid>(nullable: true),
LastModificationTime = table.Column<DateTime>(nullable: true),
LastModifierId = table.Column<Guid>(nullable: true),
IsDeleted = table.Column<bool>(nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(nullable: true),
DeletionTime = table.Column<DateTime>(nullable: true),
TenantId = table.Column<Guid>(nullable: true),
AccountGroupName = table.Column<string>(nullable: true),
UserId = table.Column<Guid>(nullable: false),
Balance = table.Column<decimal>(type: "decimal(20,8)", nullable: false),
LockedBalance = table.Column<decimal>(type: "decimal(20,8)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EasyAbpPaymentServicePrepaymentAccounts", x => x.Id);
});
migrationBuilder.CreateTable(
name: "EasyAbpPaymentServicePrepaymentTransactions",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ExtraProperties = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(nullable: false),
CreatorId = table.Column<Guid>(nullable: true),
TenantId = table.Column<Guid>(nullable: true),
AccountId = table.Column<Guid>(nullable: false),
AccountUserId = table.Column<Guid>(nullable: false),
PaymentId = table.Column<Guid>(nullable: true),
TransactionType = table.Column<int>(nullable: false),
ActionName = table.Column<string>(nullable: true),
PaymentMethod = table.Column<string>(nullable: true),
ExternalTradingCode = table.Column<string>(nullable: true),
Currency = table.Column<string>(nullable: true),
ChangedBalance = table.Column<decimal>(type: "decimal(20,8)", nullable: false),
OriginalBalance = table.Column<decimal>(type: "decimal(20,8)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EasyAbpPaymentServicePrepaymentTransactions", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_EasyAbpPaymentServicePrepaymentAccounts_UserId",
table: "EasyAbpPaymentServicePrepaymentAccounts",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_EasyAbpPaymentServicePrepaymentTransactions_AccountId",
table: "EasyAbpPaymentServicePrepaymentTransactions",
column: "AccountId");
migrationBuilder.CreateIndex(
name: "IX_EasyAbpPaymentServicePrepaymentTransactions_AccountUserId",
table: "EasyAbpPaymentServicePrepaymentTransactions",
column: "AccountUserId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "EasyAbpPaymentServicePrepaymentAccounts");
migrationBuilder.DropTable(
name: "EasyAbpPaymentServicePrepaymentTransactions");
}
}
}

4180
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200826214249_RemovedCurrencyFromPaymentItem.Designer.cs

File diff suppressed because it is too large

23
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200826214249_RemovedCurrencyFromPaymentItem.cs

@ -0,0 +1,23 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace EShopSample.Migrations
{
public partial class RemovedCurrencyFromPaymentItem : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Currency",
table: "EasyAbpEShopPaymentsPaymentItems");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Currency",
table: "EasyAbpEShopPaymentsPaymentItems",
type: "nvarchar(max)",
nullable: true);
}
}
}

4174
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200828083149_RemovedSpecifiedInventoryProviderName.Designer.cs

File diff suppressed because it is too large

33
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200828083149_RemovedSpecifiedInventoryProviderName.cs

@ -0,0 +1,33 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace EShopSample.Migrations
{
public partial class RemovedSpecifiedInventoryProviderName : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "SpecifiedInventoryProviderName",
table: "EasyAbpEShopProductsProductSkus");
migrationBuilder.DropColumn(
name: "SpecifiedInventoryProviderName",
table: "EasyAbpEShopProductsProducts");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "SpecifiedInventoryProviderName",
table: "EasyAbpEShopProductsProductSkus",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "SpecifiedInventoryProviderName",
table: "EasyAbpEShopProductsProducts",
type: "nvarchar(max)",
nullable: true);
}
}
}

145
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/EShopSampleMigrationsDbContextModelSnapshot.cs

@ -339,9 +339,6 @@ namespace EShopSample.Migrations
.HasColumnName("CreatorId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Currency")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId")
.HasColumnType("uniqueidentifier");
@ -1248,9 +1245,6 @@ namespace EShopSample.Migrations
b.Property<Guid>("ProductTypeId")
.HasColumnType("uniqueidentifier");
b.Property<string>("SpecifiedInventoryProviderName")
.HasColumnType("nvarchar(max)");
b.Property<string>("UniqueName")
.HasColumnType("nvarchar(450)");
@ -1439,9 +1433,6 @@ namespace EShopSample.Migrations
b.Property<string>("SerializedAttributeOptionIds")
.HasColumnType("nvarchar(max)");
b.Property<string>("SpecifiedInventoryProviderName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("ProductId");
@ -1669,6 +1660,142 @@ namespace EShopSample.Migrations
b.ToTable("EasyAbpPaymentServicePaymentItems");
});
modelBuilder.Entity("EasyAbp.PaymentService.Prepayment.Accounts.Account", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("AccountGroupName")
.HasColumnType("nvarchar(max)");
b.Property<decimal>("Balance")
.HasColumnType("decimal(20,8)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("nvarchar(40)")
.HasMaxLength(40);
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime")
.HasColumnType("datetime2");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId")
.HasColumnType("uniqueidentifier");
b.Property<decimal>("LockedBalance")
.HasColumnType("decimal(20,8)");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("UserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("EasyAbpPaymentServicePrepaymentAccounts");
});
modelBuilder.Entity("EasyAbp.PaymentService.Prepayment.Transactions.Transaction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("AccountId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("AccountUserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("ActionName")
.HasColumnType("nvarchar(max)");
b.Property<decimal>("ChangedBalance")
.HasColumnType("decimal(20,8)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("nvarchar(40)")
.HasMaxLength(40);
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Currency")
.HasColumnType("nvarchar(max)");
b.Property<string>("ExternalTradingCode")
.HasColumnType("nvarchar(max)");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<decimal>("OriginalBalance")
.HasColumnType("decimal(20,8)");
b.Property<Guid?>("PaymentId")
.HasColumnType("uniqueidentifier");
b.Property<string>("PaymentMethod")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.Property<int>("TransactionType")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("AccountId");
b.HasIndex("AccountUserId");
b.ToTable("EasyAbpPaymentServicePrepaymentTransactions");
});
modelBuilder.Entity("EasyAbp.PaymentService.Refunds.Refund", b =>
{
b.Property<Guid>("Id")

5
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore/EShopSample.EntityFrameworkCore.csproj

@ -11,8 +11,9 @@
<ProjectReference Include="..\..\..\..\..\integration\EasyAbp.EShop\src\EasyAbp.EShop.EntityFrameworkCore\EasyAbp.EShop.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\..\plugins\Baskets\src\EasyAbp.EShop.Plugins.Baskets.EntityFrameworkCore\EasyAbp.EShop.Plugins.Baskets.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\EShopSample.Domain\EShopSample.Domain.csproj" />
<PackageReference Include="EasyAbp.PaymentService.EntityFrameworkCore" Version="1.1.4" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.EntityFrameworkCore" Version="1.1.4" />
<PackageReference Include="EasyAbp.PaymentService.EntityFrameworkCore" Version="1.1.7" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.EntityFrameworkCore" Version="1.1.7" />
<PackageReference Include="EasyAbp.PaymentService.Prepayment.EntityFrameworkCore" Version="1.1.7" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="3.0.5" />
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="3.0.5" />
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="3.0.5" />

4
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore/EntityFrameworkCore/EShopSampleEntityFrameworkCoreModule.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.Extensions.DependencyInjection;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
@ -31,7 +32,8 @@ namespace EShopSample.EntityFrameworkCore
typeof(EShopEntityFrameworkCoreModule),
typeof(EShopPluginsBasketsEntityFrameworkCoreModule),
typeof(PaymentServiceEntityFrameworkCoreModule),
typeof(PaymentServiceWeChatPayEntityFrameworkCoreModule)
typeof(PaymentServiceWeChatPayEntityFrameworkCoreModule),
typeof(PaymentServicePrepaymentEntityFrameworkCoreModule)
)]
public class EShopSampleEntityFrameworkCoreModule : AbpModule
{

5
samples/EShopSample/aspnet-core/src/EShopSample.HttpApi.Client/EShopSample.HttpApi.Client.csproj

@ -14,8 +14,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="EasyAbp.PaymentService.HttpApi.Client" Version="1.1.4" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.HttpApi.Client" Version="1.1.4" />
<PackageReference Include="EasyAbp.PaymentService.HttpApi.Client" Version="1.1.7" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.HttpApi.Client" Version="1.1.7" />
<PackageReference Include="EasyAbp.PaymentService.Prepayment.HttpApi.Client" Version="1.1.7" />
<PackageReference Include="Volo.Abp.Account.HttpApi.Client" Version="3.0.5" />
<PackageReference Include="Volo.Abp.Identity.HttpApi.Client" Version="3.0.5" />
<PackageReference Include="Volo.Abp.PermissionManagement.HttpApi.Client" Version="3.0.5" />

4
samples/EShopSample/aspnet-core/src/EShopSample.HttpApi.Client/EShopSampleHttpApiClientModule.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 Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Account;
@ -22,7 +23,8 @@ namespace EShopSample
typeof(EShopHttpApiClientModule),
typeof(EShopPluginsBasketsHttpApiClientModule),
typeof(PaymentServiceHttpApiClientModule),
typeof(PaymentServiceWeChatPayHttpApiClientModule)
typeof(PaymentServiceWeChatPayHttpApiClientModule),
typeof(PaymentServicePrepaymentHttpApiClientModule)
)]
public class EShopSampleHttpApiClientModule : AbpModule
{

5
samples/EShopSample/aspnet-core/src/EShopSample.HttpApi/EShopSample.HttpApi.csproj

@ -14,8 +14,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="EasyAbp.PaymentService.HttpApi" Version="1.1.4" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.HttpApi" Version="1.1.4" />
<PackageReference Include="EasyAbp.PaymentService.HttpApi" Version="1.1.7" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.HttpApi" Version="1.1.7" />
<PackageReference Include="EasyAbp.PaymentService.Prepayment.HttpApi" Version="1.1.7" />
<PackageReference Include="Volo.Abp.Account.HttpApi" Version="3.0.5" />
<PackageReference Include="Volo.Abp.Identity.HttpApi" Version="3.0.5" />
<PackageReference Include="Volo.Abp.PermissionManagement.HttpApi" Version="3.0.5" />

4
samples/EShopSample/aspnet-core/src/EShopSample.HttpApi/EShopSampleHttpApiModule.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;
@ -21,7 +22,8 @@ namespace EShopSample
typeof(EShopHttpApiModule),
typeof(EShopPluginsBasketsHttpApiModule),
typeof(PaymentServiceHttpApiModule),
typeof(PaymentServiceWeChatPayHttpApiModule)
typeof(PaymentServiceWeChatPayHttpApiModule),
typeof(PaymentServicePrepaymentHttpApiModule)
)]
public class EShopSampleHttpApiModule : AbpModule
{

5
samples/EShopSample/aspnet-core/src/EShopSample.Web/EShopSample.Web.csproj

@ -46,8 +46,9 @@
<ProjectReference Include="..\EShopSample.Application\EShopSample.Application.csproj" />
<ProjectReference Include="..\EShopSample.HttpApi\EShopSample.HttpApi.csproj" />
<ProjectReference Include="..\EShopSample.EntityFrameworkCore.DbMigrations\EShopSample.EntityFrameworkCore.DbMigrations.csproj" />
<PackageReference Include="EasyAbp.PaymentService.Web" Version="1.1.4" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.Web" Version="1.1.4" />
<PackageReference Include="EasyAbp.PaymentService.Web" Version="1.1.7" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.Web" Version="1.1.7" />
<PackageReference Include="EasyAbp.PaymentService.Prepayment.Web" Version="1.1.7" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic" Version="3.0.5" />
<PackageReference Include="Volo.Abp.Autofac" Version="3.0.5" />
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="3.0.5" />

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save