Browse Source

Merge branch 'dev'

# Conflicts:
#	azure-pipelines.yml
pull/103/head 0.13.0
gdlcf88 6 years ago
parent
commit
8b61ddc9b6
  1. 7
      EShop.sln
  2. 4
      common.props
  3. 4
      integration/EasyAbp.EShop/src/EasyAbp.EShop.Application.Contracts/EasyAbp.EShop.Application.Contracts.csproj
  4. 4
      integration/EasyAbp.EShop/src/EasyAbp.EShop.Application/EasyAbp.EShop.Application.csproj
  5. 2
      integration/EasyAbp.EShop/src/EasyAbp.EShop.Domain.Shared/EasyAbp.EShop.Domain.Shared.csproj
  6. 2
      integration/EasyAbp.EShop/src/EasyAbp.EShop.Domain/EasyAbp.EShop.Domain.csproj
  7. 2
      integration/EasyAbp.EShop/src/EasyAbp.EShop.EntityFrameworkCore/EasyAbp.EShop.EntityFrameworkCore.csproj
  8. 2
      integration/EasyAbp.EShop/src/EasyAbp.EShop.HttpApi.Client/EasyAbp.EShop.HttpApi.Client.csproj
  9. 2
      integration/EasyAbp.EShop/src/EasyAbp.EShop.HttpApi/EasyAbp.EShop.HttpApi.csproj
  10. 2
      integration/EasyAbp.EShop/src/EasyAbp.EShop.MongoDB/EasyAbp.EShop.MongoDB.csproj
  11. 4
      integration/EasyAbp.EShop/src/EasyAbp.EShop.Web/EasyAbp.EShop.Web.csproj
  12. 2
      integration/EasyAbp.EShop/test/EasyAbp.EShop.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.HttpApi.Client.ConsoleTestApp.csproj
  13. 6
      integration/EasyAbp.EShop/test/EasyAbp.EShop.TestBase/EasyAbp.EShop.TestBase.csproj
  14. 4
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp.EShop.Orders.Application.Contracts.csproj
  15. 3
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/Dtos/CreateOrderDto.cs
  16. 2
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/Dtos/OrderDto.cs
  17. 6
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/Dtos/OrderLineDto.cs
  18. 5
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp.EShop.Orders.Application.csproj
  19. 3
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/EShopOrdersApplicationModule.cs
  20. 21
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/NewOrderGenerator.cs
  21. 49
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/OrderAppService.cs
  22. 1
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/OrdersApplicationAutoMapperProfile.cs
  23. 3
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp.EShop.Orders.Domain.Shared.csproj
  24. 4
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/EShopOrdersDomainSharedModule.cs
  25. 5
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/cs.json
  26. 5
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/en.json
  27. 5
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/pl.json
  28. 5
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/pt-BR.json
  29. 5
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/sl.json
  30. 5
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/tr.json
  31. 5
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/vi.json
  32. 5
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/zh-Hans.json
  33. 5
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/zh-Hant.json
  34. 5
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/IOrder.cs
  35. 7
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/IOrderLine.cs
  36. 10
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/OrderCanceledEto.cs
  37. 10
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/OrderCompletedEto.cs
  38. 2
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/OrderEto.cs
  39. 4
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/OrderLineEto.cs
  40. 1
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/OrderPaidEto.cs
  41. 13
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/OrderRefundedEto.cs
  42. 5
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp.EShop.Orders.Domain.csproj
  43. 4
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/EShopOrdersDomainModule.cs
  44. 2
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/BasicOrderCompletableCheckProvider.cs
  45. 2
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderCompletableCheckProvider.cs
  46. 4
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderPaymentChecker.cs
  47. 11
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderPaymentCompletedEventHandler.cs
  48. 11
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderPaymentCreatedEventHandler.cs
  49. 10
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IPaymentCompletedEventHandler.cs
  50. 11
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IPaymentCreatedEventHandler.cs
  51. 2
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IProductInventoryReductionEventHandler.cs
  52. 4
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidPaymentException.cs
  53. 5
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/Order.cs
  54. 15
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderLine.cs
  55. 26
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderManager.cs
  56. 12
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderPaymentChecker.cs
  57. 35
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/PaymentCanceledEventHandler.cs
  58. 18
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/PaymentCompletedEventHandler.cs
  59. 10
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/PaymentCreatedEventHandler.cs
  60. 4
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/ProductInventoryReductionEventHandler.cs
  61. 23
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/RefundCompletedEventHandler.cs
  62. 2
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp.EShop.Orders.EntityFrameworkCore.csproj
  63. 2
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp/EShop/Orders/EntityFrameworkCore/OrdersDbContextModelCreatingExtensions.cs
  64. 2
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi.Client/EasyAbp.EShop.Orders.HttpApi.Client.csproj
  65. 2
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi/EasyAbp.EShop.Orders.HttpApi.csproj
  66. 2
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/EasyAbp.EShop.Orders.MongoDB.csproj
  67. 4
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/EasyAbp.EShop.Orders.Web.csproj
  68. 3
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/OrdersWebAutoMapperProfile.cs
  69. 4
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/Orders/Order/Index.cshtml
  70. 4
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/Orders/Order/index.js
  71. 2
      modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Orders.HttpApi.Client.ConsoleTestApp.csproj
  72. 6
      modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.TestBase/EasyAbp.EShop.Orders.TestBase.csproj
  73. 4
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp.EShop.Payments.Application.Contracts.csproj
  74. 4
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/PaymentAlreadyExistsException.cs
  75. 5
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp.EShop.Payments.Application.csproj
  76. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/BasicPayableCheckProvider.cs
  77. 22
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/PaymentAppService.cs
  78. 19
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/RefundAppService.cs
  79. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp.EShop.Payments.Domain.Shared.csproj
  80. 10
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Payments/EShopPaymentCanceledEto.cs
  81. 10
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Payments/EShopPaymentCompletedEto.cs
  82. 48
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Payments/EShopPaymentEto.cs
  83. 35
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Payments/EShopPaymentItemEto.cs
  84. 7
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Refunds/EShopRefundCompletedEto.cs
  85. 4
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Refunds/EShopRefundEto.cs
  86. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Refunds/EShopRefundItemEto.cs
  87. 7
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Refunds/OrderRefundCompletedEto.cs
  88. 4
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp.EShop.Payments.Domain.csproj
  89. 16
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/EShopPaymentsDomainModule.cs
  90. 146
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Payments/PaymentSynchronizer.cs
  91. 7
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/PaymentsDomainAutoMapperProfile.cs
  92. 133
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Refunds/RefundSynchronizer.cs
  93. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.EntityFrameworkCore/EasyAbp.EShop.Payments.EntityFrameworkCore.csproj
  94. 6
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.EntityFrameworkCore/EasyAbp/EShop/Payments/Refunds/RefundRepository.cs
  95. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.HttpApi.Client/EasyAbp.EShop.Payments.HttpApi.Client.csproj
  96. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.HttpApi/EasyAbp.EShop.Payments.HttpApi.csproj
  97. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.MongoDB/EasyAbp.EShop.Payments.MongoDB.csproj
  98. 4
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Web/EasyAbp.EShop.Payments.Web.csproj
  99. 2
      modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp.csproj
  100. 6
      modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/EasyAbp.EShop.Payments.TestBase.csproj

7
EShop.sln

@ -305,6 +305,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{D261
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EShopSample", "EShopSample", "{FE0A5FD6-AEE7-4738-9A6D-261BF086704D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyAbp.EShop.Stores.Application.Shared", "modules\EasyAbp.EShop.Stores\src\EasyAbp.EShop.Stores.Application.Shared\EasyAbp.EShop.Stores.Application.Shared.csproj", "{06700175-4E04-4993-A1FB-24E7A8835E19}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -795,6 +797,10 @@ Global
{5929D955-4E2C-4E84-B9D7-F32A3375A1AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5929D955-4E2C-4E84-B9D7-F32A3375A1AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5929D955-4E2C-4E84-B9D7-F32A3375A1AA}.Release|Any CPU.Build.0 = Release|Any CPU
{06700175-4E04-4993-A1FB-24E7A8835E19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{06700175-4E04-4993-A1FB-24E7A8835E19}.Debug|Any CPU.Build.0 = Debug|Any CPU
{06700175-4E04-4993-A1FB-24E7A8835E19}.Release|Any CPU.ActiveCfg = Release|Any CPU
{06700175-4E04-4993-A1FB-24E7A8835E19}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -947,6 +953,7 @@ Global
{F5CD8112-382D-42AC-9D91-46B91D64FACB} = {9333EF8D-0A21-4586-81EB-9C39ECA2873C}
{5929D955-4E2C-4E84-B9D7-F32A3375A1AA} = {9333EF8D-0A21-4586-81EB-9C39ECA2873C}
{FE0A5FD6-AEE7-4738-9A6D-261BF086704D} = {D261DC47-83D7-4B7C-941E-E27291C78A52}
{06700175-4E04-4993-A1FB-24E7A8835E19} = {8CB54A0E-BAAE-4D10-81B5-6F902A7950EB}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F}

4
common.props

@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>0.12.0</Version>
<Version>0.13.0</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>EasyAbp Team</Authors>
@ -20,7 +20,7 @@
<ItemGroup>
<PackageReference Include="ConfigureAwait.Fody" Version="3.3.1" PrivateAssets="All" />
<PackageReference Include="Fody" Version="6.2.0">
<PackageReference Include="Fody" Version="6.2.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>

4
integration/EasyAbp.EShop/src/EasyAbp.EShop.Application.Contracts/EasyAbp.EShop.Application.Contracts.csproj

@ -8,8 +8,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Authorization" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" Version="3.0.5" />
<PackageReference Include="Volo.Abp.Authorization" Version="3.0.5" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Orders\src\EasyAbp.EShop.Orders.Application.Contracts\EasyAbp.EShop.Orders.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Payments\src\EasyAbp.EShop.Payments.Application.Contracts\EasyAbp.EShop.Payments.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Plugins\src\EasyAbp.EShop.Plugins.Application.Contracts\EasyAbp.EShop.Plugins.Application.Contracts.csproj" />

4
integration/EasyAbp.EShop/src/EasyAbp.EShop.Application/EasyAbp.EShop.Application.csproj

@ -8,8 +8,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.AutoMapper" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Ddd.Application" Version="3.0.4" />
<PackageReference Include="Volo.Abp.AutoMapper" Version="3.0.5" />
<PackageReference Include="Volo.Abp.Ddd.Application" Version="3.0.5" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Orders\src\EasyAbp.EShop.Orders.Application\EasyAbp.EShop.Orders.Application.csproj" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Payments\src\EasyAbp.EShop.Payments.Application\EasyAbp.EShop.Payments.Application.csproj" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Plugins\src\EasyAbp.EShop.Plugins.Application\EasyAbp.EShop.Plugins.Application.csproj" />

2
integration/EasyAbp.EShop/src/EasyAbp.EShop.Domain.Shared/EasyAbp.EShop.Domain.Shared.csproj

@ -9,7 +9,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Validation" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Validation" Version="3.0.5" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Orders\src\EasyAbp.EShop.Orders.Domain.Shared\EasyAbp.EShop.Orders.Domain.Shared.csproj" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Payments\src\EasyAbp.EShop.Payments.Domain.Shared\EasyAbp.EShop.Payments.Domain.Shared.csproj" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Plugins\src\EasyAbp.EShop.Plugins.Domain.Shared\EasyAbp.EShop.Plugins.Domain.Shared.csproj" />

2
integration/EasyAbp.EShop/src/EasyAbp.EShop.Domain/EasyAbp.EShop.Domain.csproj

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="3.0.5" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Orders\src\EasyAbp.EShop.Orders.Domain\EasyAbp.EShop.Orders.Domain.csproj" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Payments\src\EasyAbp.EShop.Payments.Domain\EasyAbp.EShop.Payments.Domain.csproj" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Plugins\src\EasyAbp.EShop.Plugins.Domain\EasyAbp.EShop.Plugins.Domain.csproj" />

2
integration/EasyAbp.EShop/src/EasyAbp.EShop.EntityFrameworkCore/EasyAbp.EShop.EntityFrameworkCore.csproj

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="3.0.4" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="3.0.5" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Orders\src\EasyAbp.EShop.Orders.EntityFrameworkCore\EasyAbp.EShop.Orders.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Payments\src\EasyAbp.EShop.Payments.EntityFrameworkCore\EasyAbp.EShop.Payments.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Plugins\src\EasyAbp.EShop.Plugins.EntityFrameworkCore\EasyAbp.EShop.Plugins.EntityFrameworkCore.csproj" />

2
integration/EasyAbp.EShop/src/EasyAbp.EShop.HttpApi.Client/EasyAbp.EShop.HttpApi.Client.csproj

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Http.Client" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Http.Client" Version="3.0.5" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Orders\src\EasyAbp.EShop.Orders.HttpApi.Client\EasyAbp.EShop.Orders.HttpApi.Client.csproj" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Payments\src\EasyAbp.EShop.Payments.HttpApi.Client\EasyAbp.EShop.Payments.HttpApi.Client.csproj" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Plugins\src\EasyAbp.EShop.Plugins.HttpApi.Client\EasyAbp.EShop.Plugins.HttpApi.Client.csproj" />

2
integration/EasyAbp.EShop/src/EasyAbp.EShop.HttpApi/EasyAbp.EShop.HttpApi.csproj

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="3.0.4" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="3.0.5" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Orders\src\EasyAbp.EShop.Orders.HttpApi\EasyAbp.EShop.Orders.HttpApi.csproj" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Payments\src\EasyAbp.EShop.Payments.HttpApi\EasyAbp.EShop.Payments.HttpApi.csproj" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Plugins\src\EasyAbp.EShop.Plugins.HttpApi\EasyAbp.EShop.Plugins.HttpApi.csproj" />

2
integration/EasyAbp.EShop/src/EasyAbp.EShop.MongoDB/EasyAbp.EShop.MongoDB.csproj

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.MongoDB" Version="3.0.4" />
<PackageReference Include="Volo.Abp.MongoDB" Version="3.0.5" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Orders\src\EasyAbp.EShop.Orders.MongoDB\EasyAbp.EShop.Orders.MongoDB.csproj" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Payments\src\EasyAbp.EShop.Payments.MongoDB\EasyAbp.EShop.Payments.MongoDB.csproj" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Plugins\src\EasyAbp.EShop.Plugins.MongoDB\EasyAbp.EShop.Plugins.MongoDB.csproj" />

4
integration/EasyAbp.EShop/src/EasyAbp.EShop.Web/EasyAbp.EShop.Web.csproj

@ -12,8 +12,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.AutoMapper" Version="3.0.4" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared" Version="3.0.4" />
<PackageReference Include="Volo.Abp.AutoMapper" Version="3.0.5" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared" Version="3.0.5" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Orders\src\EasyAbp.EShop.Orders.Web\EasyAbp.EShop.Orders.Web.csproj" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Payments\src\EasyAbp.EShop.Payments.Web\EasyAbp.EShop.Payments.Web.csproj" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Plugins\src\EasyAbp.EShop.Plugins.Web\EasyAbp.EShop.Plugins.Web.csproj" />

2
integration/EasyAbp.EShop/test/EasyAbp.EShop.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.HttpApi.Client.ConsoleTestApp.csproj

@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Http.Client.IdentityModel" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Http.Client.IdentityModel" Version="3.0.5" />
<ProjectReference Include="..\..\src\EasyAbp.EShop.HttpApi.Client\EasyAbp.EShop.HttpApi.Client.csproj" />
</ItemGroup>

6
integration/EasyAbp.EShop/test/EasyAbp.EShop.TestBase/EasyAbp.EShop.TestBase.csproj

@ -14,9 +14,9 @@
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="Volo.Abp.Autofac" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Authorization" Version="3.0.4" />
<PackageReference Include="Volo.Abp.TestBase" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Autofac" Version="3.0.5" />
<PackageReference Include="Volo.Abp.Authorization" Version="3.0.5" />
<PackageReference Include="Volo.Abp.TestBase" Version="3.0.5" />
<ProjectReference Include="..\..\src\EasyAbp.EShop.Domain\EasyAbp.EShop.Domain.csproj" />
</ItemGroup>

4
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp.EShop.Orders.Application.Contracts.csproj

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

3
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/Dtos/CreateOrderDto.cs

@ -3,11 +3,12 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using EasyAbp.EShop.Stores.Stores;
using Volo.Abp.Data;
namespace EasyAbp.EShop.Orders.Orders.Dtos
{
public class CreateOrderDto : IHasExtraProperties, IValidatableObject
public class CreateOrderDto : IHasExtraProperties, IValidatableObject, IMultiStore
{
[DisplayName("OrderStoreId")]
public Guid StoreId { get; set; }

2
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/Dtos/OrderDto.cs

@ -21,6 +21,8 @@ namespace EasyAbp.EShop.Orders.Orders.Dtos
public decimal TotalDiscount { get; set; }
public decimal TotalPrice { get; set; }
public decimal ActualTotalPrice { get; set; }
public decimal RefundAmount { get; set; }

6
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/Dtos/OrderLineDto.cs

@ -13,7 +13,9 @@ namespace EasyAbp.EShop.Orders.Orders.Dtos
public DateTime ProductDetailModificationTime { get; set; }
public string ProductTypeUniqueName { get; set; }
public string ProductGroupName { get; set; }
public string ProductGroupDisplayName { get; set; }
public string ProductUniqueName { get; set; }
@ -32,6 +34,8 @@ namespace EasyAbp.EShop.Orders.Orders.Dtos
public decimal TotalPrice { get; set; }
public decimal TotalDiscount { get; set; }
public decimal ActualTotalPrice { get; set; }
public int Quantity { get; set; }

5
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp.EShop.Orders.Application.csproj

@ -8,9 +8,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.AutoMapper" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Ddd.Application" Version="3.0.4" />
<PackageReference Include="Volo.Abp.AutoMapper" Version="3.0.5" />
<PackageReference Include="Volo.Abp.Ddd.Application" Version="3.0.5" />
<ProjectReference Include="..\..\..\EasyAbp.EShop.Products\src\EasyAbp.EShop.Products.Application.Contracts\EasyAbp.EShop.Products.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\EasyAbp.EShop.Stores\src\EasyAbp.EShop.Stores.Application.Shared\EasyAbp.EShop.Stores.Application.Shared.csproj" />
<ProjectReference Include="..\EasyAbp.EShop.Orders.Application.Contracts\EasyAbp.EShop.Orders.Application.Contracts.csproj" />
<ProjectReference Include="..\EasyAbp.EShop.Orders.Domain\EasyAbp.EShop.Orders.Domain.csproj" />
</ItemGroup>

3
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/EShopOrdersApplicationModule.cs

@ -1,4 +1,5 @@
using EasyAbp.EShop.Products;
using EasyAbp.EShop.Stores;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AutoMapper;
using Volo.Abp.Modularity;
@ -10,6 +11,8 @@ namespace EasyAbp.EShop.Orders
typeof(EShopOrdersDomainModule),
typeof(EShopOrdersApplicationContractsModule),
typeof(EShopProductsApplicationContractsModule),
typeof(EShopStoresDomainSharedModule),
typeof(EShopStoresApplicationSharedModule),
typeof(AbpDddApplicationModule),
typeof(AbpAutoMapperModule)
)]

21
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/NewOrderGenerator.cs

@ -44,10 +44,14 @@ namespace EasyAbp.EShop.Orders.Orders
foreach (var orderLine in input.OrderLines)
{
orderLines.Add(await GenerateNewOrderLineAsync(orderLine, productDict));
orderLines.Add(await GenerateOrderLineAsync(orderLine, productDict, orderExtraProperties));
}
var productTotalPrice = orderLines.Select(x => x.TotalPrice).Sum();
// Todo: totalPrice may contain other fee.
var totalPrice = productTotalPrice;
var totalDiscount = orderLines.Select(x => x.TotalDiscount).Sum();
var order = new Order(
id: _guidGenerator.Create(),
@ -56,8 +60,9 @@ namespace EasyAbp.EShop.Orders.Orders
customerUserId: _currentUser.GetId(),
currency: await GetStoreCurrencyAsync(input.StoreId),
productTotalPrice: productTotalPrice,
totalDiscount: orderLines.Select(x => x.TotalDiscount).Sum(),
totalPrice: productTotalPrice,
totalDiscount: totalDiscount,
totalPrice: totalPrice,
actualTotalPrice: totalPrice - totalDiscount,
customerRemark: input.CustomerRemark);
foreach (var orderExtraProperty in orderExtraProperties)
@ -72,7 +77,7 @@ namespace EasyAbp.EShop.Orders.Orders
return order;
}
protected virtual async Task<OrderLine> GenerateNewOrderLineAsync(CreateOrderLineDto input, Dictionary<Guid, ProductDto> productDict)
protected virtual async Task<OrderLine> GenerateOrderLineAsync(CreateOrderLineDto input, Dictionary<Guid, ProductDto> productDict, Dictionary<string, object> orderExtraProperties)
{
var product = productDict[input.ProductId];
var productSku = product.GetSkuById(input.ProductSkuId);
@ -81,6 +86,8 @@ namespace EasyAbp.EShop.Orders.Orders
{
throw new OrderLineInvalidQuantityException(product.Id, productSku.Id, input.Quantity);
}
var totalPrice = productSku.Price * input.Quantity;
return new OrderLine(
id: _guidGenerator.Create(),
@ -88,7 +95,8 @@ namespace EasyAbp.EShop.Orders.Orders
productSkuId: productSku.Id,
productModificationTime: product.LastModificationTime ?? product.CreationTime,
productDetailModificationTime: productSku.LastModificationTime ?? productSku.CreationTime,
productTypeUniqueName: product.ProductTypeUniqueName,
productGroupName: product.ProductGroupName,
productGroupDisplayName: product.ProductGroupDisplayName,
productUniqueName: product.UniqueName,
productDisplayName: product.DisplayName,
skuName: productSku.Name,
@ -96,8 +104,9 @@ namespace EasyAbp.EShop.Orders.Orders
mediaResources: product.MediaResources,
currency: productSku.Currency,
unitPrice: productSku.Price,
totalPrice: productSku.Price * input.Quantity,
totalPrice: totalPrice,
totalDiscount: 0,
actualTotalPrice: totalPrice,
quantity: input.Quantity
);
}

49
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/OrderAppService.cs

@ -6,21 +6,25 @@ using EasyAbp.EShop.Orders.Authorization;
using EasyAbp.EShop.Orders.Orders.Dtos;
using EasyAbp.EShop.Products.Products;
using EasyAbp.EShop.Products.Products.Dtos;
using EasyAbp.EShop.Stores.Authorization;
using EasyAbp.EShop.Stores.Stores;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Authorization;
using Volo.Abp.Users;
namespace EasyAbp.EShop.Orders.Orders
{
[Authorize]
public class OrderAppService : CrudAppService<Order, OrderDto, Guid, GetOrderListDto, CreateOrderDto>,
public class OrderAppService : MultiStoreCrudAppService<Order, OrderDto, Guid, GetOrderListDto, CreateOrderDto>,
IOrderAppService
{
protected override string CreatePolicyName { get; set; } = OrdersPermissions.Orders.Create;
protected override string GetPolicyName { get; set; } = OrdersPermissions.Orders.Default;
protected override string GetListPolicyName { get; set; } = OrdersPermissions.Orders.Default;
protected override string GetPolicyName { get; set; } = OrdersPermissions.Orders.Manage;
protected override string GetListPolicyName { get; set; } = OrdersPermissions.Orders.Manage;
protected override string CrossStorePolicyName { get; set; } = OrdersPermissions.Orders.CrossStore;
private readonly INewOrderGenerator _newOrderGenerator;
private readonly IProductAppService _productAppService;
@ -63,16 +67,7 @@ namespace EasyAbp.EShop.Orders.Orders
{
if (input.CustomerUserId != CurrentUser.GetId())
{
await AuthorizationService.CheckAsync(OrdersPermissions.Orders.Manage);
if (input.StoreId.HasValue)
{
// Todo: Check if current user is an admin of the store.
}
else
{
await AuthorizationService.CheckAsync(OrdersPermissions.Orders.CrossStore);
}
await CheckMultiStorePolicyAsync(input.StoreId, GetListPolicyName);
}
return await base.GetListAsync(input);
@ -80,23 +75,19 @@ namespace EasyAbp.EShop.Orders.Orders
public override async Task<OrderDto> GetAsync(Guid id)
{
await CheckGetPolicyAsync();
var order = await GetEntityByIdAsync(id);
if (order.CustomerUserId != CurrentUser.GetId())
{
await AuthorizationService.CheckAsync(OrdersPermissions.Orders.Manage);
// Todo: Check if current user is an admin of the store.
await CheckMultiStorePolicyAsync(order.StoreId, GetPolicyName);
}
return MapToGetOutputDto(order);
}
public override async Task<OrderDto> CreateAsync(CreateOrderDto input)
{
await CheckCreatePolicyAsync();
await CheckMultiStorePolicyAsync(input.StoreId, CreatePolicyName);
// Todo: Check if the store is open.
@ -106,7 +97,7 @@ namespace EasyAbp.EShop.Orders.Orders
var orderExtraProperties = new Dictionary<string, object>();
await _purchasableChecker.CheckAsync(input, productDict, orderExtraProperties);
var order = await _newOrderGenerator.GenerateAsync(input, productDict, orderExtraProperties);
await _orderManager.DiscountAsync(order, input.ExtraProperties);
@ -134,7 +125,7 @@ namespace EasyAbp.EShop.Orders.Orders
{
throw new NotSupportedException();
}
[RemoteService(false)]
public override Task DeleteAsync(Guid id)
{
@ -143,17 +134,13 @@ namespace EasyAbp.EShop.Orders.Orders
public virtual async Task<OrderDto> GetByOrderNumberAsync(string orderNumber)
{
await CheckGetPolicyAsync();
var order = await _repository.GetAsync(x => x.OrderNumber == orderNumber);
if (order.CustomerUserId != CurrentUser.GetId())
{
await AuthorizationService.CheckAsync(OrdersPermissions.Orders.Manage);
// Todo: Check if current user is an admin of the store.
await CheckMultiStorePolicyAsync(order.StoreId, OrdersPermissions.Orders.Manage);
}
return MapToGetOutputDto(order);
}
@ -161,12 +148,10 @@ namespace EasyAbp.EShop.Orders.Orders
public virtual async Task<OrderDto> CompleteAsync(Guid id)
{
var order = await GetEntityByIdAsync(id);
if (order.CustomerUserId != CurrentUser.GetId())
{
await AuthorizationService.CheckAsync(OrdersPermissions.Orders.Manage);
// Todo: Check if current user is an admin of the store.
await CheckMultiStorePolicyAsync(order.StoreId, OrdersPermissions.Orders.Manage);
}
order = await _orderManager.CompleteAsync(order);

1
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/OrdersApplicationAutoMapperProfile.cs

@ -1,6 +1,7 @@
using EasyAbp.EShop.Orders.Orders;
using EasyAbp.EShop.Orders.Orders.Dtos;
using AutoMapper;
using Volo.Abp.ObjectExtending;
namespace EasyAbp.EShop.Orders
{

3
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp.EShop.Orders.Domain.Shared.csproj

@ -9,7 +9,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Validation" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Validation" Version="3.0.5" />
<ProjectReference Include="..\..\..\EasyAbp.EShop.Payments\src\EasyAbp.EShop.Payments.Domain.Shared\EasyAbp.EShop.Payments.Domain.Shared.csproj" />
<ProjectReference Include="..\..\..\EasyAbp.EShop.Stores\src\EasyAbp.EShop.Stores.Domain.Shared\EasyAbp.EShop.Stores.Domain.Shared.csproj" />
</ItemGroup>

4
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/EShopOrdersDomainSharedModule.cs

@ -1,6 +1,7 @@
using Volo.Abp.Modularity;
using Volo.Abp.Localization;
using EasyAbp.EShop.Orders.Localization;
using EasyAbp.EShop.Payments;
using EasyAbp.EShop.Stores;
using Volo.Abp.Localization.ExceptionHandling;
using Volo.Abp.Validation;
@ -11,7 +12,8 @@ namespace EasyAbp.EShop.Orders
{
[DependsOn(
typeof(AbpValidationModule),
typeof(EShopStoresDomainSharedModule)
typeof(EShopStoresDomainSharedModule),
typeof(EShopPaymentsDomainSharedModule)
)]
public class EShopOrdersDomainSharedModule : AbpModule
{

5
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/cs.json

@ -11,6 +11,7 @@
"OrderProductTotalPrice": "OrderProductTotalPrice",
"OrderTotalDiscount": "OrderTotalDiscount",
"OrderTotalPrice": "OrderTotalPrice",
"OrderActualTotalPrice": "OrderActualTotalPrice",
"OrderRefundedAmount": "OrderRefundedAmount",
"OrderCustomerRemark": "OrderCustomerRemark",
"OrderStaffRemark": "OrderStaffRemark",
@ -24,7 +25,8 @@
"OrderLineProductSkuId": "OrderLineProductSkuId",
"OrderLineProductModificationTime": "OrderLineProductModificationTime",
"OrderLineProductDetailModificationTime": "OrderLineProductDetailModificationTime",
"OrderLineProductTypeUniqueName": "OrderLineProductTypeUniqueName",
"OrderLineProductGroupName": "OrderLineProductGroupName",
"OrderLineProductGroupDisplayName": "OrderLineProductGroupDisplayName",
"OrderLineProductUniqueName": "OrderLineProductUniqueName",
"OrderLineProductDisplayName": "OrderLineProductDisplayName",
"OrderLineSkuName": "OrderLineSkuName",
@ -34,6 +36,7 @@
"OrderLineUnitPrice": "OrderLineUnitPrice",
"OrderLineTotalPrice": "OrderLineTotalPrice",
"OrderLineTotalDiscount": "OrderLineTotalDiscount",
"OrderLineActualTotalPrice": "OrderLineActualTotalPrice",
"OrderLineQuantity": "OrderLineQuantity",
"CreateOrder": "CreateOrder",
"EditOrder": "EditOrder",

5
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/en.json

@ -12,6 +12,7 @@
"OrderProductTotalPrice": "OrderProductTotalPrice",
"OrderTotalDiscount": "OrderTotalDiscount",
"OrderTotalPrice": "OrderTotalPrice",
"OrderActualTotalPrice": "OrderActualTotalPrice",
"OrderRefundedAmount": "OrderRefundedAmount",
"OrderCustomerRemark": "OrderCustomerRemark",
"OrderStaffRemark": "OrderStaffRemark",
@ -25,7 +26,8 @@
"OrderLineProductSkuId": "OrderLineProductSkuId",
"OrderLineProductModificationTime": "OrderLineProductModificationTime",
"OrderLineProductDetailModificationTime": "OrderLineProductDetailModificationTime",
"OrderLineProductTypeUniqueName": "OrderLineProductTypeUniqueName",
"OrderLineProductGroupName": "OrderLineProductGroupName",
"OrderLineProductGroupDisplayName": "OrderLineProductGroupDisplayName",
"OrderLineProductUniqueName": "OrderLineProductUniqueName",
"OrderLineProductDisplayName": "OrderLineProductDisplayName",
"OrderLineSkuName": "OrderLineSkuName",
@ -35,6 +37,7 @@
"OrderLineUnitPrice": "OrderLineUnitPrice",
"OrderLineTotalPrice": "OrderLineTotalPrice",
"OrderLineTotalDiscount": "OrderLineTotalDiscount",
"OrderLineActualTotalPrice": "OrderLineActualTotalPrice",
"OrderLineQuantity": "OrderLineQuantity",
"CreateOrder": "CreateOrder",
"EditOrder": "EditOrder",

5
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/pl.json

@ -11,6 +11,7 @@
"OrderProductTotalPrice": "OrderProductTotalPrice",
"OrderTotalDiscount": "OrderTotalDiscount",
"OrderTotalPrice": "OrderTotalPrice",
"OrderActualTotalPrice": "OrderActualTotalPrice",
"OrderRefundedAmount": "OrderRefundedAmount",
"OrderCustomerRemark": "OrderCustomerRemark",
"OrderStaffRemark": "OrderStaffRemark",
@ -24,7 +25,8 @@
"OrderLineProductSkuId": "OrderLineProductSkuId",
"OrderLineProductModificationTime": "OrderLineProductModificationTime",
"OrderLineProductDetailModificationTime": "OrderLineProductDetailModificationTime",
"OrderLineProductTypeUniqueName": "OrderLineProductTypeUniqueName",
"OrderLineProductGroupName": "OrderLineProductGroupName",
"OrderLineProductGroupDisplayName": "OrderLineProductGroupDisplayName",
"OrderLineProductUniqueName": "OrderLineProductUniqueName",
"OrderLineProductDisplayName": "OrderLineProductDisplayName",
"OrderLineSkuName": "OrderLineSkuName",
@ -34,6 +36,7 @@
"OrderLineUnitPrice": "OrderLineUnitPrice",
"OrderLineTotalPrice": "OrderLineTotalPrice",
"OrderLineTotalDiscount": "OrderLineTotalDiscount",
"OrderLineActualTotalPrice": "OrderLineActualTotalPrice",
"OrderLineQuantity": "OrderLineQuantity",
"CreateOrder": "CreateOrder",
"EditOrder": "EditOrder",

5
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/pt-BR.json

@ -11,6 +11,7 @@
"OrderProductTotalPrice": "OrderProductTotalPrice",
"OrderTotalDiscount": "OrderTotalDiscount",
"OrderTotalPrice": "OrderTotalPrice",
"OrderActualTotalPrice": "OrderActualTotalPrice",
"OrderRefundedAmount": "OrderRefundedAmount",
"OrderCustomerRemark": "OrderCustomerRemark",
"OrderStaffRemark": "OrderStaffRemark",
@ -24,7 +25,8 @@
"OrderLineProductSkuId": "OrderLineProductSkuId",
"OrderLineProductModificationTime": "OrderLineProductModificationTime",
"OrderLineProductDetailModificationTime": "OrderLineProductDetailModificationTime",
"OrderLineProductTypeUniqueName": "OrderLineProductTypeUniqueName",
"OrderLineProductGroupName": "OrderLineProductGroupName",
"OrderLineProductGroupDisplayName": "OrderLineProductGroupDisplayName",
"OrderLineProductUniqueName": "OrderLineProductUniqueName",
"OrderLineProductDisplayName": "OrderLineProductDisplayName",
"OrderLineSkuName": "OrderLineSkuName",
@ -34,6 +36,7 @@
"OrderLineUnitPrice": "OrderLineUnitPrice",
"OrderLineTotalPrice": "OrderLineTotalPrice",
"OrderLineTotalDiscount": "OrderLineTotalDiscount",
"OrderLineActualTotalPrice": "OrderLineActualTotalPrice",
"OrderLineQuantity": "OrderLineQuantity",
"CreateOrder": "CreateOrder",
"EditOrder": "EditOrder",

5
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/sl.json

@ -12,6 +12,7 @@
"OrderProductTotalPrice": "OrderProductTotalPrice",
"OrderTotalDiscount": "OrderTotalDiscount",
"OrderTotalPrice": "OrderTotalPrice",
"OrderActualTotalPrice": "OrderActualTotalPrice",
"OrderRefundedAmount": "OrderRefundedAmount",
"OrderCustomerRemark": "OrderCustomerRemark",
"OrderStaffRemark": "OrderStaffRemark",
@ -25,7 +26,8 @@
"OrderLineProductSkuId": "OrderLineProductSkuId",
"OrderLineProductModificationTime": "OrderLineProductModificationTime",
"OrderLineProductDetailModificationTime": "OrderLineProductDetailModificationTime",
"OrderLineProductTypeUniqueName": "OrderLineProductTypeUniqueName",
"OrderLineProductGroupName": "OrderLineProductGroupName",
"OrderLineProductGroupDisplayName": "OrderLineProductGroupDisplayName",
"OrderLineProductUniqueName": "OrderLineProductUniqueName",
"OrderLineProductDisplayName": "OrderLineProductDisplayName",
"OrderLineSkuName": "OrderLineSkuName",
@ -35,6 +37,7 @@
"OrderLineUnitPrice": "OrderLineUnitPrice",
"OrderLineTotalPrice": "OrderLineTotalPrice",
"OrderLineTotalDiscount": "OrderLineTotalDiscount",
"OrderLineActualTotalPrice": "OrderLineActualTotalPrice",
"OrderLineQuantity": "OrderLineQuantity",
"CreateOrder": "CreateOrder",
"EditOrder": "EditOrder",

5
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/tr.json

@ -12,6 +12,7 @@
"OrderProductTotalPrice": "OrderProductTotalPrice",
"OrderTotalDiscount": "OrderTotalDiscount",
"OrderTotalPrice": "OrderTotalPrice",
"OrderActualTotalPrice": "OrderActualTotalPrice",
"OrderRefundedAmount": "OrderRefundedAmount",
"OrderCustomerRemark": "OrderCustomerRemark",
"OrderStaffRemark": "OrderStaffRemark",
@ -25,7 +26,8 @@
"OrderLineProductSkuId": "OrderLineProductSkuId",
"OrderLineProductModificationTime": "OrderLineProductModificationTime",
"OrderLineProductDetailModificationTime": "OrderLineProductDetailModificationTime",
"OrderLineProductTypeUniqueName": "OrderLineProductTypeUniqueName",
"OrderLineProductGroupName": "OrderLineProductGroupName",
"OrderLineProductGroupDisplayName": "OrderLineProductGroupDisplayName",
"OrderLineProductUniqueName": "OrderLineProductUniqueName",
"OrderLineProductDisplayName": "OrderLineProductDisplayName",
"OrderLineSkuName": "OrderLineSkuName",
@ -35,6 +37,7 @@
"OrderLineUnitPrice": "OrderLineUnitPrice",
"OrderLineTotalPrice": "OrderLineTotalPrice",
"OrderLineTotalDiscount": "OrderLineTotalDiscount",
"OrderLineActualTotalPrice": "OrderLineActualTotalPrice",
"OrderLineQuantity": "OrderLineQuantity",
"CreateOrder": "CreateOrder",
"EditOrder": "EditOrder",

5
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/vi.json

@ -11,6 +11,7 @@
"OrderProductTotalPrice": "OrderProductTotalPrice",
"OrderTotalDiscount": "OrderTotalDiscount",
"OrderTotalPrice": "OrderTotalPrice",
"OrderActualTotalPrice": "OrderActualTotalPrice",
"OrderRefundedAmount": "OrderRefundedAmount",
"OrderCustomerRemark": "OrderCustomerRemark",
"OrderStaffRemark": "OrderStaffRemark",
@ -24,7 +25,8 @@
"OrderLineProductSkuId": "OrderLineProductSkuId",
"OrderLineProductModificationTime": "OrderLineProductModificationTime",
"OrderLineProductDetailModificationTime": "OrderLineProductDetailModificationTime",
"OrderLineProductTypeUniqueName": "OrderLineProductTypeUniqueName",
"OrderLineProductGroupName": "OrderLineProductGroupName",
"OrderLineProductGroupDisplayName": "OrderLineProductGroupDisplayName",
"OrderLineProductUniqueName": "OrderLineProductUniqueName",
"OrderLineProductDisplayName": "OrderLineProductDisplayName",
"OrderLineSkuName": "OrderLineSkuName",
@ -34,6 +36,7 @@
"OrderLineUnitPrice": "OrderLineUnitPrice",
"OrderLineTotalPrice": "OrderLineTotalPrice",
"OrderLineTotalDiscount": "OrderLineTotalDiscount",
"OrderLineActualTotalPrice": "OrderLineActualTotalPrice",
"OrderLineQuantity": "OrderLineQuantity",
"CreateOrder": "CreateOrder",
"EditOrder": "EditOrder",

5
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/zh-Hans.json

@ -12,6 +12,7 @@
"OrderProductTotalPrice": "OrderProductTotalPrice",
"OrderTotalDiscount": "OrderTotalDiscount",
"OrderTotalPrice": "OrderTotalPrice",
"OrderActualTotalPrice": "OrderActualTotalPrice",
"OrderRefundedAmount": "OrderRefundedAmount",
"OrderCustomerRemark": "OrderCustomerRemark",
"OrderStaffRemark": "OrderStaffRemark",
@ -25,7 +26,8 @@
"OrderLineProductSkuId": "OrderLineProductSkuId",
"OrderLineProductModificationTime": "OrderLineProductModificationTime",
"OrderLineProductDetailModificationTime": "OrderLineProductDetailModificationTime",
"OrderLineProductTypeUniqueName": "OrderLineProductTypeUniqueName",
"OrderLineProductGroupName": "OrderLineProductGroupName",
"OrderLineProductGroupDisplayName": "OrderLineProductGroupDisplayName",
"OrderLineProductUniqueName": "OrderLineProductUniqueName",
"OrderLineProductDisplayName": "OrderLineProductDisplayName",
"OrderLineSkuName": "OrderLineSkuName",
@ -35,6 +37,7 @@
"OrderLineUnitPrice": "OrderLineUnitPrice",
"OrderLineTotalPrice": "OrderLineTotalPrice",
"OrderLineTotalDiscount": "OrderLineTotalDiscount",
"OrderLineActualTotalPrice": "OrderLineActualTotalPrice",
"OrderLineQuantity": "OrderLineQuantity",
"CreateOrder": "CreateOrder",
"EditOrder": "EditOrder",

5
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/zh-Hant.json

@ -12,6 +12,7 @@
"OrderProductTotalPrice": "OrderProductTotalPrice",
"OrderTotalDiscount": "OrderTotalDiscount",
"OrderTotalPrice": "OrderTotalPrice",
"OrderActualTotalPrice": "OrderActualTotalPrice",
"OrderRefundedAmount": "OrderRefundedAmount",
"OrderCustomerRemark": "OrderCustomerRemark",
"OrderStaffRemark": "OrderStaffRemark",
@ -25,7 +26,8 @@
"OrderLineProductSkuId": "OrderLineProductSkuId",
"OrderLineProductModificationTime": "OrderLineProductModificationTime",
"OrderLineProductDetailModificationTime": "OrderLineProductDetailModificationTime",
"OrderLineProductTypeUniqueName": "OrderLineProductTypeUniqueName",
"OrderLineProductGroupName": "OrderLineProductGroupName",
"OrderLineProductGroupDisplayName": "OrderLineProductGroupDisplayName",
"OrderLineProductUniqueName": "OrderLineProductUniqueName",
"OrderLineProductDisplayName": "OrderLineProductDisplayName",
"OrderLineSkuName": "OrderLineSkuName",
@ -35,6 +37,7 @@
"OrderLineUnitPrice": "OrderLineUnitPrice",
"OrderLineTotalPrice": "OrderLineTotalPrice",
"OrderLineTotalDiscount": "OrderLineTotalDiscount",
"OrderLineActualTotalPrice": "OrderLineActualTotalPrice",
"OrderLineQuantity": "OrderLineQuantity",
"CreateOrder": "CreateOrder",
"EditOrder": "EditOrder",

5
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/IOrder.cs

@ -18,6 +18,11 @@ namespace EasyAbp.EShop.Orders.Orders
decimal TotalDiscount { get; }
decimal TotalPrice { get; }
/// <summary>
/// ActualTotalPrice = TotalPrice - TotalDiscount
/// </summary>
decimal ActualTotalPrice { get; }
decimal RefundAmount { get; }

7
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/IOrderLine.cs

@ -12,7 +12,7 @@ namespace EasyAbp.EShop.Orders.Orders
DateTime ProductDetailModificationTime { get; }
string ProductTypeUniqueName { get; }
string ProductGroupName { get; }
string ProductUniqueName { get; }
@ -31,6 +31,11 @@ namespace EasyAbp.EShop.Orders.Orders
decimal TotalPrice { get; }
decimal TotalDiscount { get; }
/// <summary>
/// ActualTotalPrice = TotalPrice - TotalDiscount
/// </summary>
decimal ActualTotalPrice { get; }
int Quantity { get; }

10
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/OrderCanceledEto.cs

@ -0,0 +1,10 @@
using System;
namespace EasyAbp.EShop.Orders.Orders
{
[Serializable]
public class OrderCanceledEto
{
public OrderEto Order { get; set; }
}
}

10
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/OrderCompletedEto.cs

@ -0,0 +1,10 @@
using System;
namespace EasyAbp.EShop.Orders.Orders
{
[Serializable]
public class OrderCompletedEto
{
public OrderEto Order { get; set; }
}
}

2
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/OrderEto.cs

@ -27,6 +27,8 @@ namespace EasyAbp.EShop.Orders.Orders
public decimal TotalPrice { get; set; }
public decimal ActualTotalPrice { get; set; }
public decimal RefundAmount { get; set; }
public string CustomerRemark { get; set; }

4
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/OrderLineEto.cs

@ -15,7 +15,7 @@ namespace EasyAbp.EShop.Orders.Orders
public DateTime ProductDetailModificationTime { get; set; }
public string ProductTypeUniqueName { get; set; }
public string ProductGroupName { get; set; }
public string ProductUniqueName { get; set; }
@ -34,6 +34,8 @@ namespace EasyAbp.EShop.Orders.Orders
public decimal TotalPrice { get; set; }
public decimal TotalDiscount { get; set; }
public decimal ActualTotalPrice { get; set; }
public int Quantity { get; set; }

1
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/OrderPaidEto.cs

@ -2,6 +2,7 @@
namespace EasyAbp.EShop.Orders.Orders
{
[Serializable]
public class OrderPaidEto
{
public OrderEto Order { get; set; }

13
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/OrderRefundedEto.cs

@ -0,0 +1,13 @@
using System;
using EasyAbp.EShop.Payments.Refunds;
namespace EasyAbp.EShop.Orders.Orders
{
[Serializable]
public class OrderRefundedEto
{
public OrderEto Order { get; set; }
public EShopRefundEto Refund { get; set; }
}
}

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

@ -8,9 +8,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EasyAbp.PaymentService.Domain.Shared" Version="1.1.7" />
<PackageReference Include="Volo.Abp.AutoMapper" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="3.0.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" />
<ProjectReference Include="..\..\..\EasyAbp.EShop.Products\src\EasyAbp.EShop.Products.Domain.Shared\EasyAbp.EShop.Products.Domain.Shared.csproj" />
<ProjectReference Include="..\EasyAbp.EShop.Orders.Domain.Shared\EasyAbp.EShop.Orders.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}.")
{
}

5
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/Order.cs

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using EasyAbp.EShop.Stores.Stores;
using System.Linq;
using JetBrains.Annotations;
using Volo.Abp.Domain.Entities.Auditing;
@ -28,6 +29,8 @@ namespace EasyAbp.EShop.Orders.Orders
public virtual decimal TotalDiscount { get; protected set; }
public virtual decimal TotalPrice { get; protected set; }
public virtual decimal ActualTotalPrice { get; protected set; }
public virtual decimal RefundAmount { get; protected set; }
@ -67,6 +70,7 @@ namespace EasyAbp.EShop.Orders.Orders
decimal productTotalPrice,
decimal totalDiscount,
decimal totalPrice,
decimal actualTotalPrice,
[CanBeNull] string customerRemark
) : base(id)
{
@ -77,6 +81,7 @@ namespace EasyAbp.EShop.Orders.Orders
ProductTotalPrice = productTotalPrice;
TotalDiscount = totalDiscount;
TotalPrice = totalPrice;
ActualTotalPrice = actualTotalPrice;
CustomerRemark = customerRemark;
RefundAmount = 0;

15
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderLine.cs

@ -15,7 +15,10 @@ namespace EasyAbp.EShop.Orders.Orders
public virtual DateTime ProductDetailModificationTime { get; protected set; }
[NotNull]
public virtual string ProductTypeUniqueName { get; protected set; }
public virtual string ProductGroupName { get; protected set; }
[NotNull]
public virtual string ProductGroupDisplayName { get; protected set; }
[CanBeNull]
public virtual string ProductUniqueName { get; protected set; }
@ -40,6 +43,8 @@ namespace EasyAbp.EShop.Orders.Orders
public virtual decimal TotalPrice { get; protected set; }
public virtual decimal TotalDiscount { get; protected set; }
public virtual decimal ActualTotalPrice { get; protected set; }
public virtual int Quantity { get; protected set; }
@ -55,7 +60,8 @@ namespace EasyAbp.EShop.Orders.Orders
Guid productSkuId,
DateTime productModificationTime,
DateTime productDetailModificationTime,
[NotNull] string productTypeUniqueName,
[NotNull] string productGroupName,
[NotNull] string productGroupDisplayName,
[CanBeNull] string productUniqueName,
[NotNull] string productDisplayName,
[CanBeNull] string skuName,
@ -65,13 +71,15 @@ namespace EasyAbp.EShop.Orders.Orders
decimal unitPrice,
decimal totalPrice,
decimal totalDiscount,
decimal actualTotalPrice,
int quantity) : base(id)
{
ProductId = productId;
ProductSkuId = productSkuId;
ProductModificationTime = productModificationTime;
ProductDetailModificationTime = productDetailModificationTime;
ProductTypeUniqueName = productTypeUniqueName;
ProductGroupName = productGroupName;
ProductGroupDisplayName = productGroupDisplayName;
ProductUniqueName = productUniqueName;
ProductDisplayName = productDisplayName;
SkuName = skuName;
@ -81,6 +89,7 @@ namespace EasyAbp.EShop.Orders.Orders
UnitPrice = unitPrice;
TotalPrice = totalPrice;
TotalDiscount = totalDiscount;
ActualTotalPrice = actualTotalPrice;
Quantity = quantity;
RefundedQuantity = 0;

26
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderManager.cs

@ -2,20 +2,32 @@
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Domain.Services;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Timing;
using Volo.Abp.Uow;
namespace EasyAbp.EShop.Orders.Orders
{
public class OrderManager : DomainService, IOrderManager
{
private readonly IClock _clock;
private readonly IObjectMapper _objectMapper;
private readonly IDistributedEventBus _distributedEventBus;
private readonly IUnitOfWorkManager _unitOfWorkManager;
private readonly IOrderRepository _orderRepository;
public OrderManager(
IClock clock,
IObjectMapper objectMapper,
IDistributedEventBus distributedEventBus,
IUnitOfWorkManager unitOfWorkManager,
IOrderRepository orderRepository)
{
_clock = clock;
_objectMapper = objectMapper;
_distributedEventBus = distributedEventBus;
_unitOfWorkManager = unitOfWorkManager;
_orderRepository = orderRepository;
}
@ -36,7 +48,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)
{
@ -46,6 +58,12 @@ namespace EasyAbp.EShop.Orders.Orders
order.SetCompletionTime(_clock.Now);
order.SetOrderStatus(OrderStatus.Completed);
_unitOfWorkManager.Current.OnCompleted(async () => await _distributedEventBus.PublishAsync(
new OrderCompletedEto
{
Order = _objectMapper.Map<Order, OrderEto>(order)
}));
return await _orderRepository.UpdateAsync(order, true);
}
@ -63,6 +81,12 @@ namespace EasyAbp.EShop.Orders.Orders
order.SetCanceled(_clock.Now, cancellationReason);
order.SetOrderStatus(OrderStatus.Canceled);
_unitOfWorkManager.Current.OnCompleted(async () => await _distributedEventBus.PublishAsync(
new OrderCanceledEto
{
Order = _objectMapper.Map<Order, OrderEto>(order)
}));
return await _orderRepository.UpdateAsync(order, true);
}

12
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);
return Task.FromResult(order.ActualTotalPrice == 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)

23
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderRefundCompletedEventHandler.cs → modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/RefundCompletedEventHandler.cs

@ -4,25 +4,35 @@ 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.Orders.Orders
{
public class OrderRefundCompletedEventHandler : IDistributedEventHandler<OrderRefundCompletedEto>, ITransientDependency
public class RefundCompletedEventHandler : IDistributedEventHandler<EShopRefundCompletedEto>, ITransientDependency
{
private readonly ICurrentTenant _currentTenant;
private readonly IObjectMapper _objectMapper;
private readonly IUnitOfWorkManager _unitOfWorkManager;
private readonly IDistributedEventBus _distributedEventBus;
private readonly IOrderRepository _orderRepository;
public OrderRefundCompletedEventHandler(
public RefundCompletedEventHandler(
ICurrentTenant currentTenant,
IObjectMapper objectMapper,
IUnitOfWorkManager unitOfWorkManager,
IDistributedEventBus distributedEventBus,
IOrderRepository orderRepository)
{
_currentTenant = currentTenant;
_objectMapper = objectMapper;
_unitOfWorkManager = unitOfWorkManager;
_distributedEventBus = distributedEventBus;
_orderRepository = orderRepository;
}
[UnitOfWork(true)]
public virtual async Task HandleEventAsync(OrderRefundCompletedEto eventData)
public virtual async Task HandleEventAsync(EShopRefundCompletedEto eventData)
{
using var changeTenant = _currentTenant.Change(eventData.Refund.TenantId);
@ -36,6 +46,13 @@ namespace EasyAbp.EShop.Orders.Orders
}
await _orderRepository.UpdateAsync(order, true);
_unitOfWorkManager.Current.OnCompleted(async () => await _distributedEventBus.PublishAsync(
new OrderRefundedEto
{
Order = _objectMapper.Map<Order, OrderEto>(order),
Refund = eventData.Refund
}));
}
}
}

2
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp.EShop.Orders.EntityFrameworkCore.csproj

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="3.0.4" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="3.0.5" />
<ProjectReference Include="..\EasyAbp.EShop.Orders.Domain\EasyAbp.EShop.Orders.Domain.csproj" />
</ItemGroup>

2
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp/EShop/Orders/EntityFrameworkCore/OrdersDbContextModelCreatingExtensions.cs

@ -49,6 +49,7 @@ namespace EasyAbp.EShop.Orders.EntityFrameworkCore
b.Property(x => x.ProductTotalPrice).HasColumnType("decimal(20,8)");
b.Property(x => x.TotalPrice).HasColumnType("decimal(20,8)");
b.Property(x => x.TotalDiscount).HasColumnType("decimal(20,8)");
b.Property(x => x.ActualTotalPrice).HasColumnType("decimal(20,8)");
b.Property(x => x.RefundAmount).HasColumnType("decimal(20,8)");
b.HasIndex(x => x.OrderNumber).IsUnique();
});
@ -60,6 +61,7 @@ namespace EasyAbp.EShop.Orders.EntityFrameworkCore
/* Configure more properties here */
b.Property(x => x.TotalPrice).HasColumnType("decimal(20,8)");
b.Property(x => x.TotalDiscount).HasColumnType("decimal(20,8)");
b.Property(x => x.ActualTotalPrice).HasColumnType("decimal(20,8)");
b.Property(x => x.UnitPrice).HasColumnType("decimal(20,8)");
b.Property(x => x.RefundAmount).HasColumnType("decimal(20,8)");
});

2
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi.Client/EasyAbp.EShop.Orders.HttpApi.Client.csproj

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Http.Client" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Http.Client" Version="3.0.5" />
<ProjectReference Include="..\EasyAbp.EShop.Orders.Application.Contracts\EasyAbp.EShop.Orders.Application.Contracts.csproj" />
</ItemGroup>

2
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi/EasyAbp.EShop.Orders.HttpApi.csproj

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="3.0.4" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="3.0.5" />
<ProjectReference Include="..\EasyAbp.EShop.Orders.Application.Contracts\EasyAbp.EShop.Orders.Application.Contracts.csproj" />
</ItemGroup>

2
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/EasyAbp.EShop.Orders.MongoDB.csproj

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.MongoDB" Version="3.0.4" />
<PackageReference Include="Volo.Abp.MongoDB" Version="3.0.5" />
<ProjectReference Include="..\EasyAbp.EShop.Orders.Domain\EasyAbp.EShop.Orders.Domain.csproj" />
</ItemGroup>

4
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/EasyAbp.EShop.Orders.Web.csproj

@ -12,8 +12,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.AutoMapper" Version="3.0.4" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared" Version="3.0.4" />
<PackageReference Include="Volo.Abp.AutoMapper" Version="3.0.5" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared" Version="3.0.5" />
</ItemGroup>
<ItemGroup>

3
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/OrdersWebAutoMapperProfile.cs

@ -1,5 +1,6 @@
using EasyAbp.EShop.Orders.Orders.Dtos;
using AutoMapper;
using Volo.Abp.ObjectExtending;
namespace EasyAbp.EShop.Orders.Web
{
@ -10,8 +11,6 @@ namespace EasyAbp.EShop.Orders.Web
/* You can configure your AutoMapper mapping configuration here.
* Alternatively, you can split your mapping configurations
* into multiple profile classes for a better organization. */
CreateMap<OrderDto, CreateOrderDto>();
CreateMap<OrderLineDto, CreateOrderLineDto>();
}
}
}

4
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/Orders/Order/Index.cshtml

@ -34,6 +34,10 @@
<abp-style src="/Pages/EShop/Orders/Orders/Order/index.css"/>
}
<script>
let storeId = '@Model.StoreId';
</script>
<abp-card>
<abp-card-header>
<abp-row>

4
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/Orders/Order/index.js

@ -12,7 +12,9 @@ $(function () {
autoWidth: false,
scrollCollapse: true,
order: [[1, "asc"]],
ajax: abp.libs.datatables.createAjax(service.getList),
ajax: abp.libs.datatables.createAjax(service.getList, function () {
return { storeId: storeId }
}),
columnDefs: [
{
rowAction: {

2
modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Orders.HttpApi.Client.ConsoleTestApp.csproj

@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Http.Client.IdentityModel" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Http.Client.IdentityModel" Version="3.0.5" />
<ProjectReference Include="..\..\src\EasyAbp.EShop.Orders.HttpApi.Client\EasyAbp.EShop.Orders.HttpApi.Client.csproj" />
</ItemGroup>

6
modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.TestBase/EasyAbp.EShop.Orders.TestBase.csproj

@ -14,9 +14,9 @@
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="Volo.Abp.Autofac" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Authorization" Version="3.0.4" />
<PackageReference Include="Volo.Abp.TestBase" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Autofac" Version="3.0.5" />
<PackageReference Include="Volo.Abp.Authorization" Version="3.0.5" />
<PackageReference Include="Volo.Abp.TestBase" Version="3.0.5" />
<ProjectReference Include="..\..\src\EasyAbp.EShop.Orders.Domain\EasyAbp.EShop.Orders.Domain.csproj" />
</ItemGroup>

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

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

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

5
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp.EShop.Payments.Application.csproj

@ -8,9 +8,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.AutoMapper" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Ddd.Application" Version="3.0.4" />
<PackageReference Include="Volo.Abp.AutoMapper" Version="3.0.5" />
<PackageReference Include="Volo.Abp.Ddd.Application" Version="3.0.5" />
<ProjectReference Include="..\..\..\EasyAbp.EShop.Orders\src\EasyAbp.EShop.Orders.Application.Contracts\EasyAbp.EShop.Orders.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\EasyAbp.EShop.Stores\src\EasyAbp.EShop.Stores.Application.Contracts\EasyAbp.EShop.Stores.Application.Contracts.csproj" />
<ProjectReference Include="..\EasyAbp.EShop.Payments.Application.Contracts\EasyAbp.EShop.Payments.Application.Contracts.csproj" />
<ProjectReference Include="..\EasyAbp.EShop.Payments.Domain\EasyAbp.EShop.Payments.Domain.csproj" />
</ItemGroup>

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)

22
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/PaymentAppService.cs

@ -1,15 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using EasyAbp.EShop.Orders.Orders;
using EasyAbp.EShop.Orders.Orders.Dtos;
using EasyAbp.EShop.Payments.Authorization;
using EasyAbp.EShop.Payments.Payments;
using EasyAbp.EShop.Payments.Payments.Dtos;
using EasyAbp.EShop.Stores.Permissions;
using EasyAbp.PaymentService.Payments;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using EasyAbp.EShop.Stores.Stores;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.EventBus.Distributed;
@ -21,8 +21,8 @@ namespace EasyAbp.EShop.Payments.Payments
public class PaymentAppService : ReadOnlyAppService<Payment, PaymentDto, Guid, GetPaymentListDto>,
IPaymentAppService
{
protected override string GetPolicyName { get; set; } = PaymentsPermissions.Payments.Default;
protected override string GetListPolicyName { get; set; } = PaymentsPermissions.Payments.Default;
protected override string GetPolicyName { get; set; } = PaymentsPermissions.Payments.Manage;
protected override string GetListPolicyName { get; set; } = PaymentsPermissions.Payments.Manage;
private readonly IPayableChecker _payableChecker;
private readonly IDistributedEventBus _distributedEventBus;
@ -48,7 +48,7 @@ namespace EasyAbp.EShop.Payments.Payments
if (payment.UserId != CurrentUser.GetId())
{
await AuthorizationService.CheckAsync(PaymentsPermissions.Payments.Manage);
await CheckPolicyAsync(GetPolicyName);
}
return payment;
@ -71,7 +71,7 @@ namespace EasyAbp.EShop.Payments.Payments
{
if (input.UserId != CurrentUser.GetId())
{
await AuthorizationService.CheckAsync(PaymentsPermissions.Payments.Manage);
await CheckPolicyAsync(GetListPolicyName);
}
return await base.GetListAsync(input);
@ -100,7 +100,7 @@ namespace EasyAbp.EShop.Payments.Payments
{
ItemType = PaymentsConsts.PaymentItemType,
ItemKey = order.Id.ToString(),
OriginalPaymentAmount = order.TotalPrice,
OriginalPaymentAmount = order.ActualTotalPrice,
ExtraProperties = new Dictionary<string, object> {{"StoreId", order.StoreId.ToString()}}
}).ToList()
};

19
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/RefundAppService.cs

@ -1,14 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using EasyAbp.EShop.Orders.Orders;
using EasyAbp.EShop.Payments.Authorization;
using EasyAbp.EShop.Payments.Payments;
using EasyAbp.EShop.Payments.Refunds.Dtos;
using EasyAbp.EShop.Stores.Permissions;
using EasyAbp.EShop.Orders.Orders;
using EasyAbp.PaymentService.Payments;
using EasyAbp.PaymentService.Refunds;
using Microsoft.AspNetCore.Authorization;
using System;
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Data;
@ -22,8 +23,8 @@ namespace EasyAbp.EShop.Payments.Refunds
public class RefundAppService : ReadOnlyAppService<Refund, RefundDto, Guid, GetRefundListDto>,
IRefundAppService
{
protected override string GetPolicyName { get; set; } = PaymentsPermissions.Refunds.Default;
protected override string GetListPolicyName { get; set; } = PaymentsPermissions.Refunds.Default;
protected override string GetPolicyName { get; set; } = PaymentsPermissions.Refunds.Manage;
protected override string GetListPolicyName { get; set; } = PaymentsPermissions.Refunds.Manage;
private readonly IOrderAppService _orderAppService;
private readonly IDistributedEventBus _distributedEventBus;
@ -54,7 +55,7 @@ namespace EasyAbp.EShop.Payments.Refunds
if (payment.UserId != CurrentUser.GetId())
{
await AuthorizationService.CheckAsync(PaymentsPermissions.Refunds.Manage);
await CheckPolicyAsync(GetPolicyName);
}
return refund;
@ -72,7 +73,7 @@ namespace EasyAbp.EShop.Payments.Refunds
{
if (input.UserId != CurrentUser.GetId())
{
await AuthorizationService.CheckAsync(PaymentsPermissions.Refunds.Manage);
await CheckPolicyAsync(GetListPolicyName);
}
return await base.GetListAsync(input);

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

@ -9,7 +9,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Validation" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Validation" Version="3.0.5" />
<PackageReference Include="EasyAbp.PaymentService.Domain.Shared" Version="1.1.7" />
</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; }
}
}

4
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Refunds/OrderRefundEto.cs → modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Refunds/EShopRefundEto.cs

@ -7,7 +7,7 @@ using Volo.Abp.MultiTenancy;
namespace EasyAbp.EShop.Payments.Refunds
{
[Serializable]
public class OrderRefundEto : IRefund, IMultiTenant, IHasExtraProperties
public class EShopRefundEto : IRefund, IMultiTenant, IHasExtraProperties
{
#region Base properties
@ -39,6 +39,6 @@ namespace EasyAbp.EShop.Payments.Refunds
#endregion
public List<OrderRefundItemEto> RefundItems { get; set; } = new List<OrderRefundItemEto>();
public List<EShopRefundItemEto> RefundItems { get; set; } = new List<EShopRefundItemEto>();
}
}

2
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Refunds/OrderRefundItemEto.cs → modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Refunds/EShopRefundItemEto.cs

@ -6,7 +6,7 @@ using Volo.Abp.Data;
namespace EasyAbp.EShop.Payments.Refunds
{
[Serializable]
public class OrderRefundItemEto : IRefundItem, IHasExtraProperties
public class EShopRefundItemEto : IRefundItem, IHasExtraProperties
{
#region Base properties

7
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Refunds/OrderRefundCompletedEto.cs

@ -1,7 +0,0 @@
namespace EasyAbp.EShop.Payments.Refunds
{
public class OrderRefundCompletedEto
{
public OrderRefundEto Refund { get; set; }
}
}

4
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp.EShop.Payments.Domain.csproj

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

16
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,9 +12,21 @@ 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<Payment, EShopPaymentEto>(typeof(EShopPaymentsDomainModule));
options.EtoMappings.Add<Refund, EShopRefundEto>(typeof(EShopPaymentsDomainModule));
options.AutoEventSelectors.Add<Payment>();
options.AutoEventSelectors.Add<Refund>();
});
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAutoMapperObjectMapper<EShopPaymentsDomainModule>();

146
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Payments/PaymentSynchronizer.cs

@ -14,6 +14,7 @@ using Volo.Abp.Uow;
namespace EasyAbp.EShop.Payments.Payments
{
public class PaymentSynchronizer :
IDistributedEventHandler<EntityCreatedEto<PaymentEto>>,
IDistributedEventHandler<EntityUpdatedEto<PaymentEto>>,
IDistributedEventHandler<EntityDeletedEto<PaymentEto>>,
IPaymentSynchronizer,
@ -21,71 +22,152 @@ namespace EasyAbp.EShop.Payments.Payments
{
private readonly IObjectMapper _objectMapper;
private readonly ICurrentTenant _currentTenant;
private readonly IUnitOfWorkManager _unitOfWorkManager;
private readonly IPaymentRepository _paymentRepository;
private readonly IDistributedEventBus _distributedEventBus;
public PaymentSynchronizer(
IObjectMapper objectMapper,
ICurrentTenant currentTenant,
IPaymentRepository paymentRepository)
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.SetPaymentItems(
_objectMapper.Map<List<PaymentItemEto>, List<PaymentItem>>(eventData.Entity.PaymentItems));
payment.PaymentItems.ForEach(FillPaymentItemStoreId);
await _paymentRepository.InsertAsync(payment, true);
await _paymentRepository.InsertAsync(payment, true);
if (payment.CompletionTime.HasValue)
{
PublishPaymentCompletedEventOnUowCompleted(payment);
}
else
if (payment.CanceledTime.HasValue)
{
_objectMapper.Map(eventData.Entity, payment);
PublishPaymentCanceledEventOnUowCompleted(payment);
}
}
foreach (var etoItem in eventData.Entity.PaymentItems)
protected virtual void PublishPaymentCanceledEventOnUowCompleted(Payment payment)
{
_unitOfWorkManager.Current.OnCompleted(async () =>
{
await _distributedEventBus.PublishAsync(new EShopPaymentCanceledEto
{
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)
});
});
}
protected virtual void PublishPaymentCompletedEventOnUowCompleted(Payment payment)
{
_unitOfWorkManager.Current.OnCompleted(async () =>
{
await _distributedEventBus.PublishAsync(new EShopPaymentCompletedEto
{
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);
if (item == null)
{
item = _objectMapper.Map<PaymentItemEto, PaymentItem>(etoItem);
FillPaymentItemStoreId(item);
payment.PaymentItems.RemoveAll(i => !etoPaymentItemIds.Contains(i.Id));
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)

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

@ -25,8 +25,11 @@ namespace EasyAbp.EShop.Payments
CreateMap<RefundItemEto, RefundItem>(MemberList.Source)
.Ignore(x => x.StoreId)
.Ignore(x => x.OrderId);
CreateMap<Refund, OrderRefundEto>();
CreateMap<RefundItem, OrderRefundItemEto>();
CreateMap<Payment, EShopPaymentEto>();
CreateMap<PaymentItem, EShopPaymentItemEto>();
CreateMap<Refund, EShopRefundEto>();
CreateMap<RefundItem, EShopRefundItemEto>();
CreateMap<RefundItemOrderLine, RefundItemOrderLineEto>();
}
}

133
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;
@ -16,6 +17,7 @@ using Volo.Abp.Uow;
namespace EasyAbp.EShop.Payments.Refunds
{
public class RefundSynchronizer :
IDistributedEventHandler<EntityCreatedEto<RefundEto>>,
IDistributedEventHandler<EntityUpdatedEto<RefundEto>>,
IDistributedEventHandler<EntityDeletedEto<RefundEto>>,
IRefundSynchronizer,
@ -27,6 +29,7 @@ namespace EasyAbp.EShop.Payments.Refunds
private readonly IJsonSerializer _jsonSerializer;
private readonly IUnitOfWorkManager _unitOfWorkManager;
private readonly IDistributedEventBus _distributedEventBus;
private readonly IPaymentRepository _paymentRepository;
private readonly IRefundRepository _refundRepository;
public RefundSynchronizer(
@ -36,6 +39,7 @@ namespace EasyAbp.EShop.Payments.Refunds
IJsonSerializer jsonSerializer,
IUnitOfWorkManager unitOfWorkManager,
IDistributedEventBus distributedEventBus,
IPaymentRepository paymentRepository,
IRefundRepository refundRepository)
{
_objectMapper = objectMapper;
@ -44,71 +48,103 @@ namespace EasyAbp.EShop.Payments.Refunds
_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<RefundEto> eventData)
{
using var changeTenant = _currentTenant.Change(eventData.Entity.TenantId);
var publishOrderRefundCompletedEvent = false;
var refund = await _refundRepository.FindAsync(eventData.Entity.Id);
if (refund == null)
{
refund = _objectMapper.Map<RefundEto, Refund>(eventData.Entity);
refund.SetRefundItems(
_objectMapper.Map<List<RefundItemEto>, List<RefundItem>>(eventData.Entity.RefundItems));
return;
}
refund.RefundItems.ForEach(item =>
{
FillRefundItemStoreId(item);
FillRefundItemOrderId(item);
});
if (eventData.Entity.CompletedTime.HasValue && !refund.CompletedTime.HasValue)
{
_unitOfWorkManager.Current.OnCompleted(async () =>
await _distributedEventBus.PublishAsync(new EShopRefundCompletedEto
{Refund = _objectMapper.Map<Refund, EShopRefundEto>(refund)}));
}
if (refund.CompletedTime.HasValue)
_objectMapper.Map(eventData.Entity, refund);
foreach (var etoItem in eventData.Entity.RefundItems)
{
var item = refund.RefundItems.FirstOrDefault(i => i.Id == etoItem.Id);
if (item == null)
{
publishOrderRefundCompletedEvent = true;
item = _objectMapper.Map<RefundItemEto, RefundItem>(etoItem);
refund.RefundItems.Add(item);
}
await _refundRepository.InsertAsync(refund, true);
}
else
{
if (eventData.Entity.CompletedTime.HasValue && !refund.CompletedTime.HasValue)
else
{
publishOrderRefundCompletedEvent = true;
_objectMapper.Map(etoItem, item);
}
FillRefundItemStoreId(item);
FillRefundItemOrderId(item);
}
_objectMapper.Map(eventData.Entity, refund);
var etoRefundItemIds = eventData.Entity.RefundItems.Select(i => i.Id).ToList();
foreach (var etoItem in eventData.Entity.RefundItems)
{
var item = refund.RefundItems.FirstOrDefault(i => i.Id == etoItem.Id);
refund.RefundItems.RemoveAll(i => !etoRefundItemIds.Contains(i.Id));
if (item == null)
{
item = _objectMapper.Map<RefundItemEto, RefundItem>(etoItem);
refund.RefundItems.Add(item);
}
else
{
_objectMapper.Map(etoItem, item);
}
FillRefundItemOrderLines(refund);
FillRefundItemStoreId(item);
FillRefundItemOrderId(item);
}
var etoRefundItemIds = eventData.Entity.RefundItems.Select(i => i.Id).ToList();
refund.RefundItems.RemoveAll(i => !etoRefundItemIds.Contains(i.Id));
}
await _refundRepository.UpdateAsync(refund, true);
}
protected virtual void FillRefundItemOrderLines(Refund refund)
{
foreach (var refundItem in refund.RefundItems)
{
var orderLineInfoModels =
@ -135,16 +171,6 @@ namespace EasyAbp.EShop.Payments.Refunds
refundItem.RefundItemOrderLines.RemoveAll(i => !orderLineIds.Contains(i.OrderLineId));
}
}
await _refundRepository.UpdateAsync(refund, true);
var orderRefundEto = _objectMapper.Map<Refund, OrderRefundEto>(refund);
if (publishOrderRefundCompletedEvent)
{
_unitOfWorkManager.Current.OnCompleted(async () =>
await _distributedEventBus.PublishAsync(new OrderRefundCompletedEto {Refund = orderRefundEto}));
}
}
protected virtual void FillRefundItemStoreId(RefundItem item)
@ -167,8 +193,11 @@ namespace EasyAbp.EShop.Payments.Refunds
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)

2
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.EntityFrameworkCore/EasyAbp.EShop.Payments.EntityFrameworkCore.csproj

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="3.0.4" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="3.0.5" />
<ProjectReference Include="..\EasyAbp.EShop.Payments.Domain\EasyAbp.EShop.Payments.Domain.csproj" />
</ItemGroup>

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

2
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.HttpApi.Client/EasyAbp.EShop.Payments.HttpApi.Client.csproj

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Http.Client" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Http.Client" Version="3.0.5" />
<ProjectReference Include="..\EasyAbp.EShop.Payments.Application.Contracts\EasyAbp.EShop.Payments.Application.Contracts.csproj" />
</ItemGroup>

2
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.HttpApi/EasyAbp.EShop.Payments.HttpApi.csproj

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="3.0.4" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="3.0.5" />
<ProjectReference Include="..\EasyAbp.EShop.Payments.Application.Contracts\EasyAbp.EShop.Payments.Application.Contracts.csproj" />
</ItemGroup>

2
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.MongoDB/EasyAbp.EShop.Payments.MongoDB.csproj

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.MongoDB" Version="3.0.4" />
<PackageReference Include="Volo.Abp.MongoDB" Version="3.0.5" />
<ProjectReference Include="..\EasyAbp.EShop.Payments.Domain\EasyAbp.EShop.Payments.Domain.csproj" />
</ItemGroup>

4
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Web/EasyAbp.EShop.Payments.Web.csproj

@ -12,8 +12,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.AutoMapper" Version="3.0.4" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared" Version="3.0.4" />
<PackageReference Include="Volo.Abp.AutoMapper" Version="3.0.5" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared" Version="3.0.5" />
</ItemGroup>
<ItemGroup>

2
modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp.csproj

@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Http.Client.IdentityModel" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Http.Client.IdentityModel" Version="3.0.5" />
<ProjectReference Include="..\..\src\EasyAbp.EShop.Payments.HttpApi.Client\EasyAbp.EShop.Payments.HttpApi.Client.csproj" />
</ItemGroup>

6
modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/EasyAbp.EShop.Payments.TestBase.csproj

@ -14,9 +14,9 @@
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="Volo.Abp.Autofac" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Authorization" Version="3.0.4" />
<PackageReference Include="Volo.Abp.TestBase" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Autofac" Version="3.0.5" />
<PackageReference Include="Volo.Abp.Authorization" Version="3.0.5" />
<PackageReference Include="Volo.Abp.TestBase" Version="3.0.5" />
<ProjectReference Include="..\..\src\EasyAbp.EShop.Payments.Domain\EasyAbp.EShop.Payments.Domain.csproj" />
</ItemGroup>

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

Loading…
Cancel
Save