Browse Source

Merge pull request #103 from EasyAbp/plugin-coupon

A new plugin module: Coupons
pull/107/head 1.2.0
Super 5 years ago
committed by GitHub
parent
commit
9dc519a2c9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 118
      EShop.sln
  2. 2
      common.props
  3. 12
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/IOrderDiscountProvider.cs
  4. 11
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/OrderAppService.cs
  5. 12
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/DiscountAmountOverflowException.cs
  6. 10
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderDiscountProvider.cs
  7. 2
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderManager.cs
  8. 15
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/Order.cs
  9. 11
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderLine.cs
  10. 13
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderManager.cs
  11. 2
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi/EasyAbp/EShop/Orders/Orders/OrderController.cs
  12. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.HttpApi/EasyAbp/EShop/Payments/Payments/PaymentController.cs
  13. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.HttpApi/EasyAbp/EShop/Payments/Refunds/RefundController.cs
  14. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/cs.json
  15. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/en.json
  16. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/pl.json
  17. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/pt-BR.json
  18. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/sl.json
  19. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/tr.json
  20. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/vi.json
  21. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi/EasyAbp/EShop/Products/Categories/CategoryController.cs
  22. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi/EasyAbp/EShop/Products/ProductCategories/ProductCategoryController.cs
  23. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi/EasyAbp/EShop/Products/ProductDetailHistories/ProductDetailHistoryController.cs
  24. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi/EasyAbp/EShop/Products/ProductDetails/ProductDetailController.cs
  25. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi/EasyAbp/EShop/Products/ProductHistories/ProductHistoryController.cs
  26. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi/EasyAbp/EShop/Products/ProductInventories/ProductInventoryController.cs
  27. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi/EasyAbp/EShop/Products/Products/ProductController.cs
  28. 2
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/StoreOwners/Dtos/StoreOwnerDto.cs
  29. 3
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/cs.json
  30. 3
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/en.json
  31. 3
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/pl.json
  32. 3
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/pt-BR.json
  33. 3
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/sl.json
  34. 3
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/tr.json
  35. 3
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/vi.json
  36. 2
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/StoreOwners/StoreOwner.cs
  37. 2
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi/EasyAbp/EShop/Stores/StoreOwners/StoreOwnerController.cs
  38. 2
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi/EasyAbp/EShop/Stores/Stores/StoreController.cs
  39. 4
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi/EasyAbp/EShop/Stores/Transactions/TransactionController.cs
  40. 2
      plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Domain.Shared/EasyAbp/EShop/Plugins/Baskets/Localization/BasketsResource.cs
  41. 2
      plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.HttpApi/EasyAbp/EShop/Plugins/Baskets/BasketItems/BasketItemController.cs
  42. 2
      plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Web/Menus/BasketsMenuContributor.cs
  43. 2
      plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Web/Pages/EShop/Plugins/Baskets/BasketItems/BasketItem/index.js
  44. 1
      plugins/Coupons/.gitattributes
  45. 258
      plugins/Coupons/.gitignore
  46. 5
      plugins/Coupons/.prettierrc
  47. 167
      plugins/Coupons/EasyAbp.EShop.Plugins.Coupons.sln
  48. 23
      plugins/Coupons/EasyAbp.EShop.Plugins.Coupons.sln.DotSettings
  49. 13
      plugins/Coupons/docker-compose.migrations.yml
  50. 29
      plugins/Coupons/docker-compose.override.yml
  51. 25
      plugins/Coupons/docker-compose.yml
  52. 10
      plugins/Coupons/host/EasyAbp.EShop.Plugins.Coupons.Host.Shared/EasyAbp.EShop.Plugins.Coupons.Host.Shared.csproj
  53. 10
      plugins/Coupons/host/EasyAbp.EShop.Plugins.Coupons.Host.Shared/MultiTenancy/MultiTenancyConsts.cs
  54. 15
      plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp.EShop.Orders.Plugins.Coupons.csproj
  55. 18
      plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/EShopOrdersPluginsCouponsModule.cs
  56. 60
      plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/ObjectExtending/EShopOrdersPluginsCouponsObjectExtensions.cs
  57. 12
      plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/CouponNotFoundOrHasExpiredException.cs
  58. 183
      plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/CouponOrderDiscountProvider.cs
  59. 12
      plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/CouponTemplateNotFoundOrUnavailableException.cs
  60. 12
      plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/OrderDoesNotMeetCouponUsageConditionException.cs
  61. 3
      plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/FodyWeavers.xml
  62. 30
      plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/FodyWeavers.xsd
  63. 16
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp.EShop.Plugins.Coupons.Application.Contracts.csproj
  64. 34
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/Dtos/CouponTemplateDto.cs
  65. 17
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/Dtos/CouponTemplateScopeDto.cs
  66. 54
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/Dtos/CreateUpdateCouponTemplateDto.cs
  67. 16
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/Dtos/CreateUpdateCouponTemplateScopeDto.cs
  68. 18
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/ICouponTemplateAppService.cs
  69. 11
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Coupons/CouponHasBeenOccupiedException.cs
  70. 24
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Coupons/Dtos/CouponDto.cs
  71. 11
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Coupons/Dtos/CreateCouponDto.cs
  72. 22
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Coupons/Dtos/GetCouponListInput.cs
  73. 10
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Coupons/Dtos/OccupyCouponInput.cs
  74. 9
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Coupons/Dtos/UpdateCouponDto.cs
  75. 19
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Coupons/ICouponAppService.cs
  76. 16
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/EShopPluginsCouponsApplicationContractsModule.cs
  77. 33
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Permissions/CouponsPermissionDefinitionProvider.cs
  78. 34
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Permissions/CouponsPermissions.cs
  79. 3
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/FodyWeavers.xml
  80. 30
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/FodyWeavers.xsd
  81. 18
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application/EasyAbp.EShop.Plugins.Coupons.Application.csproj
  82. 114
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/CouponTemplateAppService.cs
  83. 172
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application/EasyAbp/EShop/Plugins/Coupons/Coupons/CouponAppService.cs
  84. 14
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application/EasyAbp/EShop/Plugins/Coupons/CouponsAppService.cs
  85. 30
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application/EasyAbp/EShop/Plugins/Coupons/CouponsApplicationAutoMapperProfile.cs
  86. 27
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application/EasyAbp/EShop/Plugins/Coupons/EShopPluginsCouponsApplicationModule.cs
  87. 3
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application/FodyWeavers.xml
  88. 30
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application/FodyWeavers.xsd
  89. 25
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp.EShop.Plugins.Coupons.Domain.Shared.csproj
  90. 36
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/CouponTemplateData.cs
  91. 15
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/CouponTemplateScopeData.cs
  92. 27
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/CouponType.cs
  93. 34
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/ICouponTemplate.cs
  94. 11
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/ICouponTemplateLookupService.cs
  95. 16
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/ICouponTemplateScope.cs
  96. 11
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/IHasCouponTemplateScopes.cs
  97. 25
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/Coupons/CouponData.cs
  98. 19
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/Coupons/ICoupon.cs
  99. 11
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/Coupons/ICouponLookupService.cs
  100. 11
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponsConsts.cs

118
EShop.sln

@ -307,6 +307,42 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EShopSample", "EShopSample"
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
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{72F34527-9295-4F29-923E-4B075A4F31A2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyAbp.EShop.Plugins.Coupons.Application", "plugins\Coupons\src\EasyAbp.EShop.Plugins.Coupons.Application\EasyAbp.EShop.Plugins.Coupons.Application.csproj", "{1EB6504F-7FF0-4628-9D7C-81BDE33D9490}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyAbp.EShop.Plugins.Coupons.Application.Contracts", "plugins\Coupons\src\EasyAbp.EShop.Plugins.Coupons.Application.Contracts\EasyAbp.EShop.Plugins.Coupons.Application.Contracts.csproj", "{C7D05698-E509-4F5C-A792-0036190AE6FF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyAbp.EShop.Plugins.Coupons.Domain", "plugins\Coupons\src\EasyAbp.EShop.Plugins.Coupons.Domain\EasyAbp.EShop.Plugins.Coupons.Domain.csproj", "{4DBC9216-80FD-4E71-BCB3-0F1ADA63AEC2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyAbp.EShop.Plugins.Coupons.Domain.Shared", "plugins\Coupons\src\EasyAbp.EShop.Plugins.Coupons.Domain.Shared\EasyAbp.EShop.Plugins.Coupons.Domain.Shared.csproj", "{31F1DC02-5790-4FAD-A8F2-0D6F9FE21F00}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyAbp.EShop.Plugins.Coupons.EntityFrameworkCore", "plugins\Coupons\src\EasyAbp.EShop.Plugins.Coupons.EntityFrameworkCore\EasyAbp.EShop.Plugins.Coupons.EntityFrameworkCore.csproj", "{EE6B9D10-7038-4CDE-A6BF-3941AFD84D7A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyAbp.EShop.Plugins.Coupons.HttpApi", "plugins\Coupons\src\EasyAbp.EShop.Plugins.Coupons.HttpApi\EasyAbp.EShop.Plugins.Coupons.HttpApi.csproj", "{0E22DE0A-032B-442E-AEB2-E299B333BADC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyAbp.EShop.Plugins.Coupons.HttpApi.Client", "plugins\Coupons\src\EasyAbp.EShop.Plugins.Coupons.HttpApi.Client\EasyAbp.EShop.Plugins.Coupons.HttpApi.Client.csproj", "{85D39FAB-A9A8-4942-BF94-A6061FCFBF7A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyAbp.EShop.Plugins.Coupons.MongoDB", "plugins\Coupons\src\EasyAbp.EShop.Plugins.Coupons.MongoDB\EasyAbp.EShop.Plugins.Coupons.MongoDB.csproj", "{C97330F5-4634-4865-9D7D-E33F87808938}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyAbp.EShop.Plugins.Coupons.Web", "plugins\Coupons\src\EasyAbp.EShop.Plugins.Coupons.Web\EasyAbp.EShop.Plugins.Coupons.Web.csproj", "{C11BD71D-FA6B-4833-9CAE-82ED9D857A84}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{4001814E-A67B-490D-9E13-2FB9A34B0A0B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyAbp.EShop.Plugins.Coupons.Application.Tests", "plugins\Coupons\test\EasyAbp.EShop.Plugins.Coupons.Application.Tests\EasyAbp.EShop.Plugins.Coupons.Application.Tests.csproj", "{10675CED-5689-4B2F-895A-E13820928A3B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyAbp.EShop.Plugins.Coupons.Domain.Tests", "plugins\Coupons\test\EasyAbp.EShop.Plugins.Coupons.Domain.Tests\EasyAbp.EShop.Plugins.Coupons.Domain.Tests.csproj", "{B29ABA23-37B2-419A-9E3C-F1A8703D584D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyAbp.EShop.Plugins.Coupons.EntityFrameworkCore.Tests", "plugins\Coupons\test\EasyAbp.EShop.Plugins.Coupons.EntityFrameworkCore.Tests\EasyAbp.EShop.Plugins.Coupons.EntityFrameworkCore.Tests.csproj", "{D81EC4DC-3944-4CFE-875A-5DD07BE487AE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyAbp.EShop.Plugins.Coupons.HttpApi.Client.ConsoleTestApp", "plugins\Coupons\test\EasyAbp.EShop.Plugins.Coupons.HttpApi.Client.ConsoleTestApp\EasyAbp.EShop.Plugins.Coupons.HttpApi.Client.ConsoleTestApp.csproj", "{8B22E009-5ABA-4878-83E5-38154F2B8E2F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyAbp.EShop.Plugins.Coupons.MongoDB.Tests", "plugins\Coupons\test\EasyAbp.EShop.Plugins.Coupons.MongoDB.Tests\EasyAbp.EShop.Plugins.Coupons.MongoDB.Tests.csproj", "{86CAD303-A0E5-42C9-89A5-61D9AAA4AD8F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyAbp.EShop.Plugins.Coupons.TestBase", "plugins\Coupons\test\EasyAbp.EShop.Plugins.Coupons.TestBase\EasyAbp.EShop.Plugins.Coupons.TestBase.csproj", "{B076C103-DF0B-464B-A9CB-4BE5CAFEE067}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyAbp.EShop.Orders.Plugins.Coupons", "plugins\Coupons\src\EasyAbp.EShop.Orders.Plugins.Coupons\EasyAbp.EShop.Orders.Plugins.Coupons.csproj", "{3C385657-8365-470F-9F4F-30F31F9FCA42}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -801,6 +837,70 @@ Global
{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
{1EB6504F-7FF0-4628-9D7C-81BDE33D9490}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1EB6504F-7FF0-4628-9D7C-81BDE33D9490}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1EB6504F-7FF0-4628-9D7C-81BDE33D9490}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1EB6504F-7FF0-4628-9D7C-81BDE33D9490}.Release|Any CPU.Build.0 = Release|Any CPU
{C7D05698-E509-4F5C-A792-0036190AE6FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C7D05698-E509-4F5C-A792-0036190AE6FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C7D05698-E509-4F5C-A792-0036190AE6FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C7D05698-E509-4F5C-A792-0036190AE6FF}.Release|Any CPU.Build.0 = Release|Any CPU
{4DBC9216-80FD-4E71-BCB3-0F1ADA63AEC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4DBC9216-80FD-4E71-BCB3-0F1ADA63AEC2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4DBC9216-80FD-4E71-BCB3-0F1ADA63AEC2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4DBC9216-80FD-4E71-BCB3-0F1ADA63AEC2}.Release|Any CPU.Build.0 = Release|Any CPU
{31F1DC02-5790-4FAD-A8F2-0D6F9FE21F00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{31F1DC02-5790-4FAD-A8F2-0D6F9FE21F00}.Debug|Any CPU.Build.0 = Debug|Any CPU
{31F1DC02-5790-4FAD-A8F2-0D6F9FE21F00}.Release|Any CPU.ActiveCfg = Release|Any CPU
{31F1DC02-5790-4FAD-A8F2-0D6F9FE21F00}.Release|Any CPU.Build.0 = Release|Any CPU
{EE6B9D10-7038-4CDE-A6BF-3941AFD84D7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EE6B9D10-7038-4CDE-A6BF-3941AFD84D7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EE6B9D10-7038-4CDE-A6BF-3941AFD84D7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EE6B9D10-7038-4CDE-A6BF-3941AFD84D7A}.Release|Any CPU.Build.0 = Release|Any CPU
{0E22DE0A-032B-442E-AEB2-E299B333BADC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0E22DE0A-032B-442E-AEB2-E299B333BADC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0E22DE0A-032B-442E-AEB2-E299B333BADC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0E22DE0A-032B-442E-AEB2-E299B333BADC}.Release|Any CPU.Build.0 = Release|Any CPU
{85D39FAB-A9A8-4942-BF94-A6061FCFBF7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{85D39FAB-A9A8-4942-BF94-A6061FCFBF7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{85D39FAB-A9A8-4942-BF94-A6061FCFBF7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{85D39FAB-A9A8-4942-BF94-A6061FCFBF7A}.Release|Any CPU.Build.0 = Release|Any CPU
{C97330F5-4634-4865-9D7D-E33F87808938}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C97330F5-4634-4865-9D7D-E33F87808938}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C97330F5-4634-4865-9D7D-E33F87808938}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C97330F5-4634-4865-9D7D-E33F87808938}.Release|Any CPU.Build.0 = Release|Any CPU
{C11BD71D-FA6B-4833-9CAE-82ED9D857A84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C11BD71D-FA6B-4833-9CAE-82ED9D857A84}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C11BD71D-FA6B-4833-9CAE-82ED9D857A84}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C11BD71D-FA6B-4833-9CAE-82ED9D857A84}.Release|Any CPU.Build.0 = Release|Any CPU
{10675CED-5689-4B2F-895A-E13820928A3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{10675CED-5689-4B2F-895A-E13820928A3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{10675CED-5689-4B2F-895A-E13820928A3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{10675CED-5689-4B2F-895A-E13820928A3B}.Release|Any CPU.Build.0 = Release|Any CPU
{B29ABA23-37B2-419A-9E3C-F1A8703D584D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B29ABA23-37B2-419A-9E3C-F1A8703D584D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B29ABA23-37B2-419A-9E3C-F1A8703D584D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B29ABA23-37B2-419A-9E3C-F1A8703D584D}.Release|Any CPU.Build.0 = Release|Any CPU
{D81EC4DC-3944-4CFE-875A-5DD07BE487AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D81EC4DC-3944-4CFE-875A-5DD07BE487AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D81EC4DC-3944-4CFE-875A-5DD07BE487AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D81EC4DC-3944-4CFE-875A-5DD07BE487AE}.Release|Any CPU.Build.0 = Release|Any CPU
{8B22E009-5ABA-4878-83E5-38154F2B8E2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8B22E009-5ABA-4878-83E5-38154F2B8E2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8B22E009-5ABA-4878-83E5-38154F2B8E2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8B22E009-5ABA-4878-83E5-38154F2B8E2F}.Release|Any CPU.Build.0 = Release|Any CPU
{86CAD303-A0E5-42C9-89A5-61D9AAA4AD8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{86CAD303-A0E5-42C9-89A5-61D9AAA4AD8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{86CAD303-A0E5-42C9-89A5-61D9AAA4AD8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{86CAD303-A0E5-42C9-89A5-61D9AAA4AD8F}.Release|Any CPU.Build.0 = Release|Any CPU
{B076C103-DF0B-464B-A9CB-4BE5CAFEE067}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B076C103-DF0B-464B-A9CB-4BE5CAFEE067}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B076C103-DF0B-464B-A9CB-4BE5CAFEE067}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B076C103-DF0B-464B-A9CB-4BE5CAFEE067}.Release|Any CPU.Build.0 = Release|Any CPU
{3C385657-8365-470F-9F4F-30F31F9FCA42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3C385657-8365-470F-9F4F-30F31F9FCA42}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3C385657-8365-470F-9F4F-30F31F9FCA42}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3C385657-8365-470F-9F4F-30F31F9FCA42}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -954,6 +1054,24 @@ Global
{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}
{72F34527-9295-4F29-923E-4B075A4F31A2} = {6D9A736A-DE07-4517-A40A-B26D6ECD1A93}
{1EB6504F-7FF0-4628-9D7C-81BDE33D9490} = {72F34527-9295-4F29-923E-4B075A4F31A2}
{C7D05698-E509-4F5C-A792-0036190AE6FF} = {72F34527-9295-4F29-923E-4B075A4F31A2}
{4DBC9216-80FD-4E71-BCB3-0F1ADA63AEC2} = {72F34527-9295-4F29-923E-4B075A4F31A2}
{31F1DC02-5790-4FAD-A8F2-0D6F9FE21F00} = {72F34527-9295-4F29-923E-4B075A4F31A2}
{EE6B9D10-7038-4CDE-A6BF-3941AFD84D7A} = {72F34527-9295-4F29-923E-4B075A4F31A2}
{0E22DE0A-032B-442E-AEB2-E299B333BADC} = {72F34527-9295-4F29-923E-4B075A4F31A2}
{85D39FAB-A9A8-4942-BF94-A6061FCFBF7A} = {72F34527-9295-4F29-923E-4B075A4F31A2}
{C97330F5-4634-4865-9D7D-E33F87808938} = {72F34527-9295-4F29-923E-4B075A4F31A2}
{C11BD71D-FA6B-4833-9CAE-82ED9D857A84} = {72F34527-9295-4F29-923E-4B075A4F31A2}
{4001814E-A67B-490D-9E13-2FB9A34B0A0B} = {6D9A736A-DE07-4517-A40A-B26D6ECD1A93}
{10675CED-5689-4B2F-895A-E13820928A3B} = {4001814E-A67B-490D-9E13-2FB9A34B0A0B}
{B29ABA23-37B2-419A-9E3C-F1A8703D584D} = {4001814E-A67B-490D-9E13-2FB9A34B0A0B}
{D81EC4DC-3944-4CFE-875A-5DD07BE487AE} = {4001814E-A67B-490D-9E13-2FB9A34B0A0B}
{8B22E009-5ABA-4878-83E5-38154F2B8E2F} = {4001814E-A67B-490D-9E13-2FB9A34B0A0B}
{86CAD303-A0E5-42C9-89A5-61D9AAA4AD8F} = {4001814E-A67B-490D-9E13-2FB9A34B0A0B}
{B076C103-DF0B-464B-A9CB-4BE5CAFEE067} = {4001814E-A67B-490D-9E13-2FB9A34B0A0B}
{3C385657-8365-470F-9F4F-30F31F9FCA42} = {72F34527-9295-4F29-923E-4B075A4F31A2}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F}

2
common.props

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

12
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/IOrderDiscountProvider.cs

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using EasyAbp.EShop.Products.Products.Dtos;
namespace EasyAbp.EShop.Orders.Orders
{
public interface IOrderDiscountProvider
{
Task<Order> DiscountAsync(Order order, Dictionary<Guid, ProductDto> productDict);
}
}

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

@ -8,6 +8,7 @@ using EasyAbp.EShop.Products.Products;
using EasyAbp.EShop.Products.Products.Dtos;
using EasyAbp.EShop.Stores.Stores;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Users;
@ -99,12 +100,20 @@ namespace EasyAbp.EShop.Orders.Orders
var order = await _newOrderGenerator.GenerateAsync(CurrentUser.GetId(), input, productDict);
await _orderManager.DiscountAsync(order, input.ExtraProperties);
await DiscountOrderAsync(order, productDict);
await Repository.InsertAsync(order, autoSave: true);
return await MapToGetOutputDtoAsync(order);
}
protected virtual async Task DiscountOrderAsync(Order order, Dictionary<Guid, ProductDto> productDict)
{
foreach (var provider in ServiceProvider.GetServices<IOrderDiscountProvider>())
{
await provider.DiscountAsync(order, productDict);
}
}
protected virtual async Task<Dictionary<Guid, ProductDto>> GetProductDictionaryAsync(
IEnumerable<Guid> productIds, Guid storeId)

12
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/DiscountAmountOverflowException.cs

@ -0,0 +1,12 @@
using Volo.Abp;
namespace EasyAbp.EShop.Orders.Orders
{
public class DiscountAmountOverflowException : BusinessException
{
public DiscountAmountOverflowException()
: base("DiscountAmountOverflow", $"The discount amount overflow.")
{
}
}
}

10
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderDiscountProvider.cs

@ -1,10 +0,0 @@
using System.Collections.Generic;
using System.Threading.Tasks;
namespace EasyAbp.EShop.Orders.Orders
{
public interface IOrderDiscountProvider
{
Task<Order> DiscountAsync(Order order, Dictionary<string, object> inputExtraProperties);
}
}

2
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderManager.cs

@ -6,8 +6,6 @@ namespace EasyAbp.EShop.Orders.Orders
{
public interface IOrderManager : IDomainService
{
Task<Order> DiscountAsync(Order order, Dictionary<string, object> inputExtraProperties);
Task<Order> CompleteAsync(Order order);
Task<Order> CancelAsync(Order order, string cancellationReason);

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

@ -164,5 +164,20 @@ namespace EasyAbp.EShop.Orders.Orders
{
return !(!PaymentId.HasValue || PaidTime.HasValue);
}
public void AddDiscount(Guid orderLineId, decimal expectedDiscountAmount)
{
var orderLine = OrderLines.Single(x => x.Id == orderLineId);
orderLine.AddDiscount(expectedDiscountAmount);
TotalDiscount += expectedDiscountAmount;
ActualTotalPrice -= expectedDiscountAmount;
if (ActualTotalPrice < decimal.Zero)
{
throw new DiscountAmountOverflowException();
}
}
}
}

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

@ -112,5 +112,16 @@ namespace EasyAbp.EShop.Orders.Orders
RefundedQuantity += quantity;
RefundAmount += amount;
}
internal void AddDiscount(decimal expectedDiscountAmount)
{
TotalDiscount += expectedDiscountAmount;
ActualTotalPrice -= expectedDiscountAmount;
if (ActualTotalPrice < decimal.Zero)
{
throw new DiscountAmountOverflowException();
}
}
}
}

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

@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Domain.Services;
using Volo.Abp.EventBus.Distributed;
@ -30,16 +29,6 @@ namespace EasyAbp.EShop.Orders.Orders
_unitOfWorkManager = unitOfWorkManager;
_orderRepository = orderRepository;
}
public virtual async Task<Order> DiscountAsync(Order order, Dictionary<string, object> inputExtraProperties)
{
foreach (var provider in ServiceProvider.GetServices<IOrderDiscountProvider>())
{
await provider.DiscountAsync(order, inputExtraProperties);
}
return order;
}
public virtual async Task<Order> CompleteAsync(Order order)
{

2
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi/EasyAbp/EShop/Orders/Orders/OrderController.cs

@ -7,7 +7,7 @@ using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Orders.Orders
{
[RemoteService(Name = "EShopOrders")]
[RemoteService(Name = "EasyAbpEShopOrders")]
[Route("/api/eShop/orders/order")]
public class OrderController : OrdersController, IOrderAppService
{

2
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.HttpApi/EasyAbp/EShop/Payments/Payments/PaymentController.cs

@ -7,7 +7,7 @@ using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Payments.Payments
{
[RemoteService(Name = "EShopPayments")]
[RemoteService(Name = "EasyAbpEShopPayments")]
[Route("/api/eShop/payments/payment")]
public class PaymentController : PaymentsController, IPaymentAppService
{

2
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.HttpApi/EasyAbp/EShop/Payments/Refunds/RefundController.cs

@ -7,7 +7,7 @@ using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Payments.Refunds
{
[RemoteService(Name = "EShopPayments")]
[RemoteService(Name = "EasyAbpEShopPayments")]
[Route("/api/eShop/payments/refund")]
public class RefundController : PaymentsController, IRefundAppService
{

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/cs.json

@ -56,6 +56,9 @@
"EditProduct": "Edit",
"ProductDeletionConfirmationMessage": "Are you sure to delete the product {0}?",
"SuccessfullyDeleted": "Successfully deleted",
"CouponType.Normal": "Normal (X discount)",
"CouponType.PerMeet": "PerMeet (X discount for every Y)",
"CouponType.Custom": "Custom",
"Menu:Category": "Category",
"Category": "Category",
"CategoryUniqueName": "Unique name",

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/en.json

@ -57,6 +57,9 @@
"EditProduct": "Edit",
"ProductDeletionConfirmationMessage": "Are you sure to delete the product {0}?",
"SuccessfullyDeleted": "Successfully deleted",
"CouponType.Normal": "Normal (X discount)",
"CouponType.PerMeet": "PerMeet (X discount for every Y)",
"CouponType.Custom": "Custom",
"Menu:Category": "Category",
"Category": "Category",
"CategoryUniqueName": "Unique name",

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/pl.json

@ -56,6 +56,9 @@
"EditProduct": "Edit",
"ProductDeletionConfirmationMessage": "Are you sure to delete the product {0}?",
"SuccessfullyDeleted": "Successfully deleted",
"CouponType.Normal": "Normal (X discount)",
"CouponType.PerMeet": "PerMeet (X discount for every Y)",
"CouponType.Custom": "Custom",
"Menu:Category": "Category",
"Category": "Category",
"CategoryUniqueName": "Unique name",

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/pt-BR.json

@ -56,6 +56,9 @@
"EditProduct": "Edit",
"ProductDeletionConfirmationMessage": "Are you sure to delete the product {0}?",
"SuccessfullyDeleted": "Successfully deleted",
"CouponType.Normal": "Normal (X discount)",
"CouponType.PerMeet": "PerMeet (X discount for every Y)",
"CouponType.Custom": "Custom",
"Menu:Category": "Category",
"Category": "Category",
"CategoryUniqueName": "Unique name",

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/sl.json

@ -57,6 +57,9 @@
"EditProduct": "Edit",
"ProductDeletionConfirmationMessage": "Are you sure to delete the product {0}?",
"SuccessfullyDeleted": "Successfully deleted",
"CouponType.Normal": "Normal (X discount)",
"CouponType.PerMeet": "PerMeet (X discount for every Y)",
"CouponType.Custom": "Custom",
"Menu:Category": "Category",
"Category": "Category",
"CategoryUniqueName": "Unique name",

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/tr.json

@ -57,6 +57,9 @@
"EditProduct": "Edit",
"ProductDeletionConfirmationMessage": "Are you sure to delete the product {0}?",
"SuccessfullyDeleted": "Successfully deleted",
"CouponType.Normal": "Normal (X discount)",
"CouponType.PerMeet": "PerMeet (X discount for every Y)",
"CouponType.Custom": "Custom",
"Menu:Category": "Category",
"Category": "Category",
"CategoryUniqueName": "Unique name",

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/vi.json

@ -56,6 +56,9 @@
"EditProduct": "Edit",
"ProductDeletionConfirmationMessage": "Are you sure to delete the product {0}?",
"SuccessfullyDeleted": "Successfully deleted",
"CouponType.Normal": "Normal (X discount)",
"CouponType.PerMeet": "PerMeet (X discount for every Y)",
"CouponType.Custom": "Custom",
"Menu:Category": "Category",
"Category": "Category",
"CategoryUniqueName": "Unique name",

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi/EasyAbp/EShop/Products/Categories/CategoryController.cs

@ -7,7 +7,7 @@ using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Products.Categories
{
[RemoteService(Name = "EShopProducts")]
[RemoteService(Name = "EasyAbpEShopProducts")]
[Route("/api/eShop/products/category")]
public class CategoryController : ProductsController, ICategoryAppService
{

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi/EasyAbp/EShop/Products/ProductCategories/ProductCategoryController.cs

@ -7,7 +7,7 @@ using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Products.ProductCategories
{
[RemoteService(Name = "EShopProducts")]
[RemoteService(Name = "EasyAbpEShopProducts")]
[Route("/api/eShop/products/productCategory")]
public class ProductCategoryController : ProductsController, IProductCategoryAppService
{

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi/EasyAbp/EShop/Products/ProductDetailHistories/ProductDetailHistoryController.cs

@ -7,7 +7,7 @@ using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Products.ProductDetailHistories
{
[RemoteService(Name = "EShopProducts")]
[RemoteService(Name = "EasyAbpEShopProducts")]
[Route("/api/eShop/products/productDetailHistory")]
public class ProductDetailHistoryController : ProductsController, IProductDetailHistoryAppService
{

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi/EasyAbp/EShop/Products/ProductDetails/ProductDetailController.cs

@ -7,7 +7,7 @@ using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Products.ProductDetails
{
[RemoteService(Name = "EShopProducts")]
[RemoteService(Name = "EasyAbpEShopProducts")]
[Route("/api/eShop/products/productDetail")]
public class ProductDetailController : ProductsController, IProductDetailAppService
{

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi/EasyAbp/EShop/Products/ProductHistories/ProductHistoryController.cs

@ -7,7 +7,7 @@ using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Products.ProductHistories
{
[RemoteService(Name = "EShopProducts")]
[RemoteService(Name = "EasyAbpEShopProducts")]
[Route("/api/eShop/products/productHistory")]
public class ProductHistoryController : ProductsController, IProductHistoryAppService
{

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi/EasyAbp/EShop/Products/ProductInventories/ProductInventoryController.cs

@ -7,7 +7,7 @@ using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Products.ProductInventories
{
[RemoteService(Name = "EShopProducts")]
[RemoteService(Name = "EasyAbpEShopProducts")]
[Route("/api/eShop/products/productInventory")]
public class ProductInventoryController : ProductsController, IProductInventoryAppService
{

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi/EasyAbp/EShop/Products/Products/ProductController.cs

@ -7,7 +7,7 @@ using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Products.Products
{
[RemoteService(Name = "EShopProducts")]
[RemoteService(Name = "EasyAbpEShopProducts")]
[Route("/api/eShop/products/product")]
public class ProductController : ProductsController, IProductAppService
{

2
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/StoreOwners/Dtos/StoreOwnerDto.cs

@ -6,7 +6,7 @@ using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Stores.StoreOwners.Dtos
{
[Serializable]
public class StoreOwnerDto : ExtensibleFullAuditedEntityDto<Guid>, IMultiStore
public class StoreOwnerDto : ExtensibleAuditedEntityDto<Guid>, IMultiStore
{
public Guid StoreId { get; set; }

3
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/cs.json

@ -10,6 +10,9 @@
"EditStore": "Edit",
"StoreDeletionConfirmationMessage": "Are you sure to delete the store {0}?",
"SuccessfullyDeleted": "Successfully deleted",
"CouponType.Normal": "Normal (X discount)",
"CouponType.PerMeet": "PerMeet (X discount for every Y)",
"CouponType.Custom": "Custom",
"StoreOwner": "Store owner",
"Menu:StoreOwner": "Store owner",
"StoreOwnerUserName": "Username",

3
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/en.json

@ -11,6 +11,9 @@
"EditStore": "Edit",
"StoreDeletionConfirmationMessage": "Are you sure to delete the store {0}?",
"SuccessfullyDeleted": "Successfully deleted",
"CouponType.Normal": "Normal (X discount)",
"CouponType.PerMeet": "PerMeet (X discount for every Y)",
"CouponType.Custom": "Custom",
"StoreOwner": "Store owner",
"Menu:StoreOwner": "Store owner",
"StoreOwnerUserName": "Username",

3
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/pl.json

@ -10,6 +10,9 @@
"EditStore": "Edit",
"StoreDeletionConfirmationMessage": "Are you sure to delete the store {0}?",
"SuccessfullyDeleted": "Successfully deleted",
"CouponType.Normal": "Normal (X discount)",
"CouponType.PerMeet": "PerMeet (X discount for every Y)",
"CouponType.Custom": "Custom",
"StoreOwner": "Store owner",
"Menu:StoreOwner": "Store owner",
"StoreOwnerUserName": "Username",

3
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/pt-BR.json

@ -10,6 +10,9 @@
"EditStore": "Edit",
"StoreDeletionConfirmationMessage": "Are you sure to delete the store {0}?",
"SuccessfullyDeleted": "Successfully deleted",
"CouponType.Normal": "Normal (X discount)",
"CouponType.PerMeet": "PerMeet (X discount for every Y)",
"CouponType.Custom": "Custom",
"StoreOwner": "Store owner",
"Menu:StoreOwner": "Store owner",
"StoreOwnerUserName": "Username",

3
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/sl.json

@ -11,6 +11,9 @@
"EditStore": "Edit",
"StoreDeletionConfirmationMessage": "Are you sure to delete the store {0}?",
"SuccessfullyDeleted": "Successfully deleted",
"CouponType.Normal": "Normal (X discount)",
"CouponType.PerMeet": "PerMeet (X discount for every Y)",
"CouponType.Custom": "Custom",
"StoreOwner": "Store owner",
"Menu:StoreOwner": "Store owner",
"StoreOwnerUserName": "Username",

3
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/tr.json

@ -11,6 +11,9 @@
"EditStore": "Edit",
"StoreDeletionConfirmationMessage": "Are you sure to delete the store {0}?",
"SuccessfullyDeleted": "Successfully deleted",
"CouponType.Normal": "Normal (X discount)",
"CouponType.PerMeet": "PerMeet (X discount for every Y)",
"CouponType.Custom": "Custom",
"StoreOwner": "Store owner",
"Menu:StoreOwner": "Store owner",
"StoreOwnerUserName": "Username",

3
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/vi.json

@ -10,6 +10,9 @@
"EditStore": "Edit",
"StoreDeletionConfirmationMessage": "Are you sure to delete the store {0}?",
"SuccessfullyDeleted": "Successfully deleted",
"CouponType.Normal": "Normal (X discount)",
"CouponType.PerMeet": "PerMeet (X discount for every Y)",
"CouponType.Custom": "Custom",
"StoreOwner": "Store owner",
"Menu:StoreOwner": "Store owner",
"StoreOwnerUserName": "Username",

2
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/StoreOwners/StoreOwner.cs

@ -5,7 +5,7 @@ using Volo.Abp.MultiTenancy;
namespace EasyAbp.EShop.Stores.StoreOwners
{
public class StoreOwner : FullAuditedAggregateRoot<Guid>, IMultiTenant, IMultiStore
public class StoreOwner : AuditedAggregateRoot<Guid>, IMultiTenant, IMultiStore
{
public virtual Guid? TenantId { get; protected set; }

2
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi/EasyAbp/EShop/Stores/StoreOwners/StoreOwnerController.cs

@ -7,7 +7,7 @@ using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Stores.StoreOwners
{
[RemoteService(Name = "EShopStoreOwners")]
[RemoteService(Name = "EasyAbpEShopStores")]
[Route("/api/eShop/stores/storeOwner")]
public class StoreOwnerController : StoresController
{

2
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi/EasyAbp/EShop/Stores/Stores/StoreController.cs

@ -7,7 +7,7 @@ using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Stores.Stores
{
[RemoteService(Name = "EShopStores")]
[RemoteService(Name = "EasyAbpEShopStores")]
[Route("/api/eShop/stores/store")]
public class StoreController : StoresController, IStoreAppService
{

4
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi/EasyAbp/EShop/Stores/Transactions/TransactionController.cs

@ -7,8 +7,8 @@ using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Stores.Transactions
{
[RemoteService(Name = "TransactionService")]
[Route("/api/stores/transaction")]
[RemoteService(Name = "EasyAbpEShopStores")]
[Route("/api/eShop/stores/transaction")]
public class TransactionController : StoresController, ITransactionAppService
{
private readonly ITransactionAppService _service;

2
plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Domain.Shared/EasyAbp/EShop/Plugins/Baskets/Localization/BasketsResource.cs

@ -2,7 +2,7 @@
namespace EasyAbp.EShop.Plugins.Baskets.Localization
{
[LocalizationResourceName("EShopPluginsBaskets")]
[LocalizationResourceName("EasyAbpEShopPluginsBaskets")]
public class BasketsResource
{

2
plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.HttpApi/EasyAbp/EShop/Plugins/Baskets/BasketItems/BasketItemController.cs

@ -8,7 +8,7 @@ using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Plugins.Baskets.BasketItems
{
[RemoteService(Name = "EShopPluginsBaskets")]
[RemoteService(Name = "EasyAbpEShopPluginsBaskets")]
[Route("/api/eShop/plugins/baskets/basketItem")]
public class BasketItemController : BasketsController, IBasketItemAppService
{

2
plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Web/Menus/BasketsMenuContributor.cs

@ -32,7 +32,7 @@ namespace EasyAbp.EShop.Plugins.Baskets.Web.Menus
if (!basketManagementMenuItem.Items.IsNullOrEmpty())
{
var eShopMenuItem = context.Menu.Items.GetOrAdd(i => i.Name == BasketsMenus.ModuleGroupPrefix,
() => new ApplicationMenuItem(BasketsMenus.BasketItem, l["Menu:EasyAbpEShop"]));
() => new ApplicationMenuItem(BasketsMenus.ModuleGroupPrefix, l["Menu:EasyAbpEShop"]));
eShopMenuItem.Items.Add(basketManagementMenuItem);
}

2
plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Web/Pages/EShop/Plugins/Baskets/BasketItems/BasketItem/index.js

@ -1,6 +1,6 @@
$(function () {
var l = abp.localization.getResource('EShopPluginsBaskets');
var l = abp.localization.getResource('EasyAbpEShopPluginsBaskets');
var service = easyAbp.eShop.plugins.baskets.basketItems.basketItem;
var createModal = new abp.ModalManager(abp.appPath + 'EShop/Plugins/Baskets/BasketItems/BasketItem/CreateModal');

1
plugins/Coupons/.gitattributes

@ -0,0 +1 @@
**/wwwroot/libs/** linguist-vendored

258
plugins/Coupons/.gitignore

@ -0,0 +1,258 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# Coupons
host/EasyAbp.EShop.Plugins.Coupons.IdentityServer/Logs/logs.txt
host/EasyAbp.EShop.Plugins.Coupons.HttpApi.Host/Logs/logs.txt
host/EasyAbp.EShop.Plugins.Coupons.Web.Host/Logs/logs.txt
host/EasyAbp.EShop.Plugins.Coupons.Web.Unified/Logs/logs.txt

5
plugins/Coupons/.prettierrc

@ -0,0 +1,5 @@
{
"singleQuote": true,
"useTabs": false,
"tabWidth": 4
}

167
plugins/Coupons/EasyAbp.EShop.Plugins.Coupons.sln

@ -0,0 +1,167 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29001.49
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.Coupons.Domain.Shared", "src\EasyAbp.EShop.Plugins.Coupons.Domain.Shared\EasyAbp.EShop.Plugins.Coupons.Domain.Shared.csproj", "{D64C1577-4929-4B60-939E-96DE1534891A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.Coupons.Domain", "src\EasyAbp.EShop.Plugins.Coupons.Domain\EasyAbp.EShop.Plugins.Coupons.Domain.csproj", "{F2840BC7-0188-4606-9126-DADD0F5ABF7A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.Coupons.Application.Contracts", "src\EasyAbp.EShop.Plugins.Coupons.Application.Contracts\EasyAbp.EShop.Plugins.Coupons.Application.Contracts.csproj", "{BD65D04F-08D5-40C1-8C24-77CA0BACB877}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.Coupons.Application", "src\EasyAbp.EShop.Plugins.Coupons.Application\EasyAbp.EShop.Plugins.Coupons.Application.csproj", "{78040F9E-3501-4A40-82DF-00A597710F35}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{649A3FFA-182F-4E56-9717-E6A9A2BEC545}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "host", "host", "{E400416D-2895-4512-9D17-90681EEC7E0A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.Coupons.EntityFrameworkCore", "src\EasyAbp.EShop.Plugins.Coupons.EntityFrameworkCore\EasyAbp.EShop.Plugins.Coupons.EntityFrameworkCore.csproj", "{0CE86223-D31D-4315-A1F5-87BA3EE1B844}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.Coupons.MongoDB", "src\EasyAbp.EShop.Plugins.Coupons.MongoDB\EasyAbp.EShop.Plugins.Coupons.MongoDB.csproj", "{F1C58097-4C08-4D88-8976-6B3389391481}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.Coupons.HttpApi", "src\EasyAbp.EShop.Plugins.Coupons.HttpApi\EasyAbp.EShop.Plugins.Coupons.HttpApi.csproj", "{077AA5F8-8B61-420C-A6B5-0150A66FDB34}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.Coupons.HttpApi.Client", "src\EasyAbp.EShop.Plugins.Coupons.HttpApi.Client\EasyAbp.EShop.Plugins.Coupons.HttpApi.Client.csproj", "{36E2735F-CEAB-44C8-A6D1-2CDAFF399751}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.Coupons.TestBase", "test\EasyAbp.EShop.Plugins.Coupons.TestBase\EasyAbp.EShop.Plugins.Coupons.TestBase.csproj", "{C5BB573D-3030-4BCB-88B7-F6A85C32766C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.Coupons.EntityFrameworkCore.Tests", "test\EasyAbp.EShop.Plugins.Coupons.EntityFrameworkCore.Tests\EasyAbp.EShop.Plugins.Coupons.EntityFrameworkCore.Tests.csproj", "{527F645C-C1FC-406E-8479-81386C8ECF13}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.Coupons.MongoDB.Tests", "test\EasyAbp.EShop.Plugins.Coupons.MongoDB.Tests\EasyAbp.EShop.Plugins.Coupons.MongoDB.Tests.csproj", "{D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.Coupons.Domain.Tests", "test\EasyAbp.EShop.Plugins.Coupons.Domain.Tests\EasyAbp.EShop.Plugins.Coupons.Domain.Tests.csproj", "{E60895E5-79C4-447D-88B7-85CB5BA336A4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.Coupons.Application.Tests", "test\EasyAbp.EShop.Plugins.Coupons.Application.Tests\EasyAbp.EShop.Plugins.Coupons.Application.Tests.csproj", "{90CB5DC4-C040-45C7-8900-9688B26405BC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.Coupons.HttpApi.Host", "host\EasyAbp.EShop.Plugins.Coupons.HttpApi.Host\EasyAbp.EShop.Plugins.Coupons.HttpApi.Host.csproj", "{37B135B0-DAFE-4616-B25C-1BDF32FC44A2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.Coupons.Web", "src\EasyAbp.EShop.Plugins.Coupons.Web\EasyAbp.EShop.Plugins.Coupons.Web.csproj", "{3B7B6317-1B85-4164-8E11-75574F80AE17}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.Coupons.HttpApi.Client.ConsoleTestApp", "test\EasyAbp.EShop.Plugins.Coupons.HttpApi.Client.ConsoleTestApp\EasyAbp.EShop.Plugins.Coupons.HttpApi.Client.ConsoleTestApp.csproj", "{1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.Coupons.Web.Host", "host\EasyAbp.EShop.Plugins.Coupons.Web.Host\EasyAbp.EShop.Plugins.Coupons.Web.Host.csproj", "{73513786-B6C6-4A21-89C5-0FBDD0A46107}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.Coupons.IdentityServer", "host\EasyAbp.EShop.Plugins.Coupons.IdentityServer\EasyAbp.EShop.Plugins.Coupons.IdentityServer.csproj", "{690203F4-3CD5-4569-88D9-EE831EEA5F5F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.Coupons.Host.Shared", "host\EasyAbp.EShop.Plugins.Coupons.Host.Shared\EasyAbp.EShop.Plugins.Coupons.Host.Shared.csproj", "{F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.Coupons.Web.Unified", "host\EasyAbp.EShop.Plugins.Coupons.Web.Unified\EasyAbp.EShop.Plugins.Coupons.Web.Unified.csproj", "{3D872C41-E226-45C8-89C1-9D3DBD7C73F2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D64C1577-4929-4B60-939E-96DE1534891A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D64C1577-4929-4B60-939E-96DE1534891A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D64C1577-4929-4B60-939E-96DE1534891A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D64C1577-4929-4B60-939E-96DE1534891A}.Release|Any CPU.Build.0 = Release|Any CPU
{F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Release|Any CPU.Build.0 = Release|Any CPU
{BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Release|Any CPU.Build.0 = Release|Any CPU
{78040F9E-3501-4A40-82DF-00A597710F35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{78040F9E-3501-4A40-82DF-00A597710F35}.Debug|Any CPU.Build.0 = Debug|Any CPU
{78040F9E-3501-4A40-82DF-00A597710F35}.Release|Any CPU.ActiveCfg = Release|Any CPU
{78040F9E-3501-4A40-82DF-00A597710F35}.Release|Any CPU.Build.0 = Release|Any CPU
{0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Release|Any CPU.Build.0 = Release|Any CPU
{F1C58097-4C08-4D88-8976-6B3389391481}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F1C58097-4C08-4D88-8976-6B3389391481}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F1C58097-4C08-4D88-8976-6B3389391481}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F1C58097-4C08-4D88-8976-6B3389391481}.Release|Any CPU.Build.0 = Release|Any CPU
{077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Debug|Any CPU.Build.0 = Debug|Any CPU
{077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Release|Any CPU.ActiveCfg = Release|Any CPU
{077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Release|Any CPU.Build.0 = Release|Any CPU
{36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Debug|Any CPU.Build.0 = Debug|Any CPU
{36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Release|Any CPU.ActiveCfg = Release|Any CPU
{36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Release|Any CPU.Build.0 = Release|Any CPU
{C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Release|Any CPU.Build.0 = Release|Any CPU
{527F645C-C1FC-406E-8479-81386C8ECF13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{527F645C-C1FC-406E-8479-81386C8ECF13}.Debug|Any CPU.Build.0 = Debug|Any CPU
{527F645C-C1FC-406E-8479-81386C8ECF13}.Release|Any CPU.ActiveCfg = Release|Any CPU
{527F645C-C1FC-406E-8479-81386C8ECF13}.Release|Any CPU.Build.0 = Release|Any CPU
{D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}.Release|Any CPU.Build.0 = Release|Any CPU
{E60895E5-79C4-447D-88B7-85CB5BA336A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E60895E5-79C4-447D-88B7-85CB5BA336A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E60895E5-79C4-447D-88B7-85CB5BA336A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E60895E5-79C4-447D-88B7-85CB5BA336A4}.Release|Any CPU.Build.0 = Release|Any CPU
{90CB5DC4-C040-45C7-8900-9688B26405BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{90CB5DC4-C040-45C7-8900-9688B26405BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{90CB5DC4-C040-45C7-8900-9688B26405BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{90CB5DC4-C040-45C7-8900-9688B26405BC}.Release|Any CPU.Build.0 = Release|Any CPU
{37B135B0-DAFE-4616-B25C-1BDF32FC44A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{37B135B0-DAFE-4616-B25C-1BDF32FC44A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{37B135B0-DAFE-4616-B25C-1BDF32FC44A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{37B135B0-DAFE-4616-B25C-1BDF32FC44A2}.Release|Any CPU.Build.0 = Release|Any CPU
{3B7B6317-1B85-4164-8E11-75574F80AE17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3B7B6317-1B85-4164-8E11-75574F80AE17}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B7B6317-1B85-4164-8E11-75574F80AE17}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3B7B6317-1B85-4164-8E11-75574F80AE17}.Release|Any CPU.Build.0 = Release|Any CPU
{1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Release|Any CPU.Build.0 = Release|Any CPU
{73513786-B6C6-4A21-89C5-0FBDD0A46107}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{73513786-B6C6-4A21-89C5-0FBDD0A46107}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73513786-B6C6-4A21-89C5-0FBDD0A46107}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73513786-B6C6-4A21-89C5-0FBDD0A46107}.Release|Any CPU.Build.0 = Release|Any CPU
{690203F4-3CD5-4569-88D9-EE831EEA5F5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{690203F4-3CD5-4569-88D9-EE831EEA5F5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{690203F4-3CD5-4569-88D9-EE831EEA5F5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{690203F4-3CD5-4569-88D9-EE831EEA5F5F}.Release|Any CPU.Build.0 = Release|Any CPU
{F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}.Release|Any CPU.Build.0 = Release|Any CPU
{3D872C41-E226-45C8-89C1-9D3DBD7C73F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3D872C41-E226-45C8-89C1-9D3DBD7C73F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3D872C41-E226-45C8-89C1-9D3DBD7C73F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3D872C41-E226-45C8-89C1-9D3DBD7C73F2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{D64C1577-4929-4B60-939E-96DE1534891A} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545}
{F2840BC7-0188-4606-9126-DADD0F5ABF7A} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545}
{BD65D04F-08D5-40C1-8C24-77CA0BACB877} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545}
{78040F9E-3501-4A40-82DF-00A597710F35} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545}
{0CE86223-D31D-4315-A1F5-87BA3EE1B844} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545}
{F1C58097-4C08-4D88-8976-6B3389391481} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545}
{077AA5F8-8B61-420C-A6B5-0150A66FDB34} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545}
{36E2735F-CEAB-44C8-A6D1-2CDAFF399751} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545}
{C5BB573D-3030-4BCB-88B7-F6A85C32766C} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D}
{527F645C-C1FC-406E-8479-81386C8ECF13} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D}
{D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D}
{E60895E5-79C4-447D-88B7-85CB5BA336A4} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D}
{90CB5DC4-C040-45C7-8900-9688B26405BC} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D}
{37B135B0-DAFE-4616-B25C-1BDF32FC44A2} = {E400416D-2895-4512-9D17-90681EEC7E0A}
{3B7B6317-1B85-4164-8E11-75574F80AE17} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545}
{1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D}
{73513786-B6C6-4A21-89C5-0FBDD0A46107} = {E400416D-2895-4512-9D17-90681EEC7E0A}
{690203F4-3CD5-4569-88D9-EE831EEA5F5F} = {E400416D-2895-4512-9D17-90681EEC7E0A}
{F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB} = {E400416D-2895-4512-9D17-90681EEC7E0A}
{3D872C41-E226-45C8-89C1-9D3DBD7C73F2} = {E400416D-2895-4512-9D17-90681EEC7E0A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4324B3B4-B60B-4E3C-91D8-59576B4E26DD}
EndGlobalSection
EndGlobal

23
plugins/Coupons/EasyAbp.EShop.Plugins.Coupons.sln.DotSettings

@ -0,0 +1,23 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/IntelliSenseCompletingCharacters/CSharpCompletingCharacters/UpgradedFromVSSettings/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceDoWhileStatementBraces/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceFixedStatementBraces/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceForeachStatementBraces/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceForStatementBraces/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceIfStatementBraces/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceLockStatementBraces/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceUsingStatementBraces/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceWhileStatementBraces/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_FOR/@EntryValue">Required</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_FOREACH/@EntryValue">Required</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_IFELSE/@EntryValue">Required</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_WHILE/@EntryValue">Required</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_REDUNDANT/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/Generate/=Implementations/@KeyIndexDefined">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Generate/=Implementations/Options/=Async/@EntryIndexedValue">False</s:String>
<s:String x:Key="/Default/CodeStyle/Generate/=Implementations/Options/=Mutable/@EntryIndexedValue">False</s:String>
<s:Boolean x:Key="/Default/CodeStyle/Generate/=Overrides/@KeyIndexDefined">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=Async/@EntryIndexedValue">False</s:String>
<s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=Mutable/@EntryIndexedValue">False</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SQL/@EntryIndexedValue">SQL</s:String>
</wpf:ResourceDictionary>

13
plugins/Coupons/docker-compose.migrations.yml

@ -0,0 +1,13 @@
version: '3.4'
services:
migrations:
build:
context: ../../
dockerfile: templates/service/database/Dockerfile
depends_on:
- sqlserver
environment:
- IdentityServer_DB=Coupons_Identity
- Coupons_DB=Coupons_ModuleDb
- SA_PASSWORD=yourStrong(!)Password

29
plugins/Coupons/docker-compose.override.yml

@ -0,0 +1,29 @@
version: '3.4'
services:
sqlserver:
environment:
- SA_PASSWORD=yourStrong(!)Password
- ACCEPT_EULA=Y
ports:
- "51599:1433"
identity-server:
environment:
- ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionStrings__Default=Server=sqlserver;Database=Coupons_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- ConnectionStrings__SqlServerCache=Server=sqlserver;Database=Coupons_Cache;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false
ports:
- "51600:80"
coupons:
environment:
- ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionStrings__Default=Server=sqlserver;Database=Coupons_ModuleDb;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- ConnectionStrings__AbpSettingManagement=Server=sqlserver;Database=Coupons_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- ConnectionStrings__AbpPermissionManagement=Server=sqlserver;Database=Coupons_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- ConnectionStrings__AbpAuditLogging=Server=sqlserver;Database=Coupons_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- ConnectionStrings__SqlServerCache=Server=sqlserver;Database=Coupons_Cache;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- AuthServer__Authority=http://identity-server
ports:
- "51601:80"

25
plugins/Coupons/docker-compose.yml

@ -0,0 +1,25 @@
version: '3.4'
services:
sqlserver:
image: mcr.microsoft.com/mssql/server
volumes:
- dbdata:/var/opt/mssql
identity-server:
build:
context: ../../
dockerfile: templates/service/host/IdentityServerHost/Dockerfile
depends_on:
- sqlserver
coupons:
build:
context: ../../
dockerfile: templates/service/host/EasyAbp.EShop.Plugins.Coupons.Host/Dockerfile
depends_on:
- sqlserver
- identity-server
volumes:
dbdata:

10
plugins/Coupons/host/EasyAbp.EShop.Plugins.Coupons.Host.Shared/EasyAbp.EShop.Plugins.Coupons.Host.Shared.csproj

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>EasyAbp.EShop.Plugins.Coupons</RootNamespace>
</PropertyGroup>
</Project>

10
plugins/Coupons/host/EasyAbp.EShop.Plugins.Coupons.Host.Shared/MultiTenancy/MultiTenancyConsts.cs

@ -0,0 +1,10 @@
namespace EasyAbp.EShop.Plugins.Coupons.MultiTenancy
{
public static class MultiTenancyConsts
{
/* Enable/disable multi-tenancy in a single point
* to test your module with multi-tenancy.
*/
public const bool IsEnabled = false;
}
}

15
plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp.EShop.Orders.Plugins.Coupons.csproj

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Orders\src\EasyAbp.EShop.Orders.Application\EasyAbp.EShop.Orders.Application.csproj" />
<ProjectReference Include="..\EasyAbp.EShop.Plugins.Coupons.Application.Contracts\EasyAbp.EShop.Plugins.Coupons.Application.Contracts.csproj" />
</ItemGroup>
</Project>

18
plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/EShopOrdersPluginsCouponsModule.cs

@ -0,0 +1,18 @@
using EasyAbp.EShop.Orders.Plugins.Coupons.ObjectExtending;
using EasyAbp.EShop.Plugins.Coupons;
using Volo.Abp.Modularity;
namespace EasyAbp.EShop.Orders.Plugins.Coupons
{
[DependsOn(
typeof(EShopOrdersDomainModule),
typeof(EShopPluginsCouponsApplicationContractsModule)
)]
public class EShopOrdersPluginsCouponsModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
EShopOrdersPluginsCouponsObjectExtensions.Configure();
}
}
}

60
plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/ObjectExtending/EShopOrdersPluginsCouponsObjectExtensions.cs

@ -0,0 +1,60 @@
using System;
using EasyAbp.EShop.Orders.Orders;
using EasyAbp.EShop.Orders.Orders.Dtos;
using EasyAbp.EShop.Plugins.Coupons;
using Volo.Abp.ObjectExtending;
using Volo.Abp.Threading;
namespace EasyAbp.EShop.Orders.Plugins.Coupons.ObjectExtending
{
public static class EShopOrdersPluginsCouponsObjectExtensions
{
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
public static void Configure()
{
OneTimeRunner.Run(() =>
{
/* You can configure extension properties to entities or other object types
* defined in the depended modules.
*
* If you are using EF Core and want to map the entity extension properties to new
* table fields in the database, then configure them in the EShopSampleEfCoreEntityExtensionMappings
*
* Example:
*
* ObjectExtensionManager.Instance
* .AddOrUpdateProperty<IdentityRole, string>("Title");
*
* See the documentation for more:
* https://docs.abp.io/en/abp/latest/Object-Extensions
*/
ObjectExtensionManager.Instance
.AddOrUpdate(
new[]
{
typeof(Order),
typeof(CreateOrderDto)
},
config =>
{
config.AddOrUpdateProperty<Guid?>(CouponsConsts.OrderCouponIdPropertyName);
}
);
ObjectExtensionManager.Instance
.AddOrUpdate(
new[]
{
typeof(Order)
},
config =>
{
config.AddOrUpdateProperty<decimal>(CouponsConsts.OrderCouponDiscountAmountPropertyName);
}
);
});
}
}
}

12
plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/CouponNotFoundOrHasExpiredException.cs

@ -0,0 +1,12 @@
using Volo.Abp;
namespace EasyAbp.EShop.Orders.Plugins.Coupons.OrderDiscount
{
public class CouponNotFoundOrHasExpiredException : BusinessException
{
public CouponNotFoundOrHasExpiredException() : base("CouponNotFoundOrHasExpired",
"Coupon not found or has expired.")
{
}
}
}

183
plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/CouponOrderDiscountProvider.cs

@ -0,0 +1,183 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using EasyAbp.EShop.Orders.Orders;
using EasyAbp.EShop.Plugins.Coupons;
using EasyAbp.EShop.Plugins.Coupons.Coupons;
using EasyAbp.EShop.Plugins.Coupons.Coupons.Dtos;
using EasyAbp.EShop.Plugins.Coupons.CouponTemplates;
using EasyAbp.EShop.Products.Products.Dtos;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Timing;
namespace EasyAbp.EShop.Orders.Plugins.Coupons.OrderDiscount
{
public class CouponOrderDiscountProvider : IOrderDiscountProvider, ITransientDependency
{
private readonly IClock _clock;
private readonly ICouponAppService _couponAppService;
private readonly ICouponLookupService _couponLookupService;
private readonly ICouponTemplateLookupService _couponTemplateLookupService;
public CouponOrderDiscountProvider(
IClock clock,
ICouponAppService couponAppService,
ICouponLookupService couponLookupService,
ICouponTemplateLookupService couponTemplateLookupService)
{
_clock = clock;
_couponAppService = couponAppService;
_couponLookupService = couponLookupService;
_couponTemplateLookupService = couponTemplateLookupService;
}
public virtual async Task<Order> DiscountAsync(Order order, Dictionary<Guid, ProductDto> productDict)
{
if (!Guid.TryParse(order.GetProperty<string>(CouponsConsts.OrderCouponIdPropertyName),
out var couponId))
{
return order;
}
var now = _clock.Now;
var coupon = await _couponLookupService.FindByIdAsync(couponId);
if (coupon == null || coupon.ExpirationTime < now)
{
throw new CouponNotFoundOrHasExpiredException();
}
if (coupon.OrderId.HasValue)
{
throw new CouponHasBeenOccupiedException();
}
var couponTemplate = await _couponTemplateLookupService.FindByIdAsync(coupon.CouponTemplateId);
if (couponTemplate == null ||
!IsInUsableTime(couponTemplate, now))
{
throw new CouponTemplateNotFoundOrUnavailableException();
}
var orderLinesInScope = GetOrderLinesInScope(couponTemplate, order, productDict);
DiscountOrderLines(couponTemplate, order, orderLinesInScope);
await _couponAppService.OccupyAsync(coupon.Id, new OccupyCouponInput {OrderId = order.Id});
return order;
}
protected virtual void DiscountOrderLines(CouponTemplateData couponTemplate, Order order,
List<OrderLine> orderLinesInScope)
{
// Todo: support Custom coupon.
if (couponTemplate.CouponType == CouponType.Custom)
{
throw new NotSupportedException();
}
var totalOrderLineActualTotalPrice = orderLinesInScope.Sum(x => x.ActualTotalPrice);
var totalDiscountedAmount = couponTemplate.CouponType == CouponType.PerMeet
? couponTemplate.DiscountAmount *
Math.Floor(totalOrderLineActualTotalPrice / couponTemplate.ConditionAmount)
: couponTemplate.DiscountAmount;
if (totalDiscountedAmount > totalOrderLineActualTotalPrice)
{
totalDiscountedAmount = totalOrderLineActualTotalPrice;
}
var remainingDiscountedAmount = totalDiscountedAmount;
// Todo: https://github.com/EasyAbp/EShop/issues/104
const int accuracy = 2;
foreach (var orderLine in orderLinesInScope)
{
var maxDiscountAmount =
Math.Round(orderLine.ActualTotalPrice / totalOrderLineActualTotalPrice * totalDiscountedAmount,
accuracy, MidpointRounding.ToZero);
var discountAmount = maxDiscountAmount > orderLine.ActualTotalPrice
? orderLine.ActualTotalPrice
: maxDiscountAmount;
order.AddDiscount(orderLine.Id, discountAmount);
remainingDiscountedAmount -= discountAmount;
}
foreach (var orderLine in orderLinesInScope.OrderByDescending(x => x.ActualTotalPrice))
{
if (remainingDiscountedAmount == decimal.Zero)
{
break;
}
var discountAmount = remainingDiscountedAmount > orderLine.ActualTotalPrice
? orderLine.ActualTotalPrice
: remainingDiscountedAmount;
order.AddDiscount(orderLine.Id, discountAmount);
remainingDiscountedAmount -= discountAmount;
}
if (remainingDiscountedAmount != decimal.Zero)
{
throw new ApplicationException();
}
order.SetProperty(CouponsConsts.OrderCouponDiscountAmountPropertyName, totalDiscountedAmount);
}
protected virtual List<OrderLine> GetOrderLinesInScope(CouponTemplateData couponTemplate, Order order,
Dictionary<Guid, ProductDto> productDict)
{
if (couponTemplate.IsUnscoped)
{
return order.OrderLines;
}
var expectedOrderLines = new List<OrderLine>();
foreach (var scope in couponTemplate.Scopes.Where(scope => scope.StoreId == order.StoreId))
{
expectedOrderLines.AddRange(order.OrderLines
.WhereIf(scope.ProductGroupName != null,
x => productDict[x.ProductId].ProductGroupName == scope.ProductGroupName)
.WhereIf(scope.ProductId.HasValue, x => x.ProductId == scope.ProductId)
.WhereIf(scope.ProductSkuId.HasValue, x => x.ProductSkuId == scope.ProductSkuId));
}
if (expectedOrderLines.IsNullOrEmpty())
{
throw new OrderDoesNotMeetCouponUsageConditionException();
}
if (expectedOrderLines.Sum(x => GetOrderLineProductPrice(x, productDict) * x.Quantity) <
couponTemplate.ConditionAmount)
{
throw new OrderDoesNotMeetCouponUsageConditionException();
}
return expectedOrderLines;
}
protected virtual decimal GetOrderLineProductPrice(OrderLine orderLine, Dictionary<Guid, ProductDto> productDict)
{
return productDict[orderLine.ProductId].GetSkuById(orderLine.ProductSkuId).Price;
}
protected virtual bool IsInUsableTime(ICouponTemplate couponTemplate, DateTime now)
{
return couponTemplate.UsableBeginTime <= now && couponTemplate.UsableEndTime > now;
}
}
}

12
plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/CouponTemplateNotFoundOrUnavailableException.cs

@ -0,0 +1,12 @@
using Volo.Abp;
namespace EasyAbp.EShop.Orders.Plugins.Coupons.OrderDiscount
{
public class CouponTemplateNotFoundOrUnavailableException : BusinessException
{
public CouponTemplateNotFoundOrUnavailableException() : base("CouponTemplateNotFoundOrUnavailable",
"Coupon template not found or unavailable.")
{
}
}
}

12
plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/OrderDoesNotMeetCouponUsageConditionException.cs

@ -0,0 +1,12 @@
using Volo.Abp;
namespace EasyAbp.EShop.Orders.Plugins.Coupons.OrderDiscount
{
public class OrderDoesNotMeetCouponUsageConditionException : BusinessException
{
public OrderDoesNotMeetCouponUsageConditionException() : base("OrderDoesNotMeetCouponUsageCondition",
"Order does not meet the coupon usage condition.")
{
}
}
}

3
plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait />
</Weavers>

30
plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

16
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp.EShop.Plugins.Coupons.Application.Contracts.csproj

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" Version="3.1.2" />
<PackageReference Include="Volo.Abp.Authorization" Version="3.1.2" />
<ProjectReference Include="..\EasyAbp.EShop.Plugins.Coupons.Domain.Shared\EasyAbp.EShop.Plugins.Coupons.Domain.Shared.csproj" />
</ItemGroup>
</Project>

34
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/Dtos/CouponTemplateDto.cs

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Plugins.Coupons.CouponTemplates.Dtos
{
[Serializable]
public class CouponTemplateDto : FullAuditedEntityDto<Guid>, ICouponTemplate, IHasCouponTemplateScopes<CouponTemplateScopeDto>
{
public Guid? StoreId { get; set; }
public CouponType CouponType { get; set; }
public string UniqueName { get; set; }
public string DisplayName { get; set; }
public string Description { get; set; }
public TimeSpan? UsableDuration { get; set; }
public DateTime? UsableBeginTime { get; set; }
public DateTime? UsableEndTime { get; set; }
public decimal ConditionAmount { get; set; }
public decimal DiscountAmount { get; set; }
public bool IsUnscoped { get; set; }
public List<CouponTemplateScopeDto> Scopes { get; set; }
}
}

17
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/Dtos/CouponTemplateScopeDto.cs

@ -0,0 +1,17 @@
using System;
using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Plugins.Coupons.CouponTemplates.Dtos
{
[Serializable]
public class CouponTemplateScopeDto : FullAuditedEntityDto<Guid>, ICouponTemplateScope
{
public Guid StoreId { get; set; }
public string ProductGroupName { get; set; }
public Guid? ProductId { get; set; }
public Guid? ProductSkuId { get; set; }
}
}

54
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/Dtos/CreateUpdateCouponTemplateDto.cs

@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace EasyAbp.EShop.Plugins.Coupons.CouponTemplates.Dtos
{
[Serializable]
public class CreateUpdateCouponTemplateDto : IValidatableObject
{
public Guid? StoreId { get; set; }
public CouponType CouponType { get; set; }
public string UniqueName { get; set; }
public string DisplayName { get; set; }
public string Description { get; set; }
public TimeSpan? UsableDuration { get; set; }
public DateTime? UsableBeginTime { get; set; }
public DateTime? UsableEndTime { get; set; }
public decimal ConditionAmount { get; set; }
public decimal DiscountAmount { get; set; }
public bool IsUnscoped { get; set; }
public List<CreateUpdateCouponTemplateScopeDto> Scopes { get; set; } = new List<CreateUpdateCouponTemplateScopeDto>();
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if (DiscountAmount > ConditionAmount)
{
yield return new ValidationResult(
"DiscountAmount should not be greater than ConditionAmount!",
new[] { nameof(DiscountAmount) }
);
}
if (CouponType == CouponType.PerMeet && ConditionAmount == decimal.Zero)
{
yield return new ValidationResult(
"ConditionAmount should be greater than zero if the CouponType is PerMeet!",
new[] { nameof(ConditionAmount) }
);
}
}
}
}

16
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/Dtos/CreateUpdateCouponTemplateScopeDto.cs

@ -0,0 +1,16 @@
using System;
namespace EasyAbp.EShop.Plugins.Coupons.CouponTemplates.Dtos
{
[Serializable]
public class CreateUpdateCouponTemplateScopeDto
{
public Guid StoreId { get; set; }
public string ProductGroupName { get; set; }
public Guid? ProductId { get; set; }
public Guid? ProductSkuId { get; set; }
}
}

18
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/ICouponTemplateAppService.cs

@ -0,0 +1,18 @@
using System;
using EasyAbp.EShop.Plugins.Coupons.CouponTemplates.Dtos;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace EasyAbp.EShop.Plugins.Coupons.CouponTemplates
{
public interface ICouponTemplateAppService :
ICrudAppService<
CouponTemplateDto,
Guid,
PagedAndSortedResultRequestDto,
CreateUpdateCouponTemplateDto,
CreateUpdateCouponTemplateDto>
{
}
}

11
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Coupons/CouponHasBeenOccupiedException.cs

@ -0,0 +1,11 @@
using Volo.Abp;
namespace EasyAbp.EShop.Plugins.Coupons.Coupons
{
public class CouponHasBeenOccupiedException : BusinessException
{
public CouponHasBeenOccupiedException() : base("CouponHasBeenOccupied", "Coupon has been occupied.")
{
}
}
}

24
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Coupons/Dtos/CouponDto.cs

@ -0,0 +1,24 @@
using System;
using EasyAbp.EShop.Plugins.Coupons.CouponTemplates.Dtos;
using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Plugins.Coupons.Coupons.Dtos
{
[Serializable]
public class CouponDto : FullAuditedEntityDto<Guid>, ICoupon
{
public Guid CouponTemplateId { get; set; }
public Guid UserId { get; set; }
public Guid? OrderId { get; set; }
public DateTime? ExpirationTime { get; set; }
public DateTime? UsedTime { get; set; }
public decimal? DiscountedAmount { get; set; }
public CouponTemplateDto CouponTemplate { get; set; }
}
}

11
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Coupons/Dtos/CreateCouponDto.cs

@ -0,0 +1,11 @@
using System;
namespace EasyAbp.EShop.Plugins.Coupons.Coupons.Dtos
{
[Serializable]
public class CreateCouponDto
{
public Guid CouponTemplateId { get; set; }
public Guid UserId { get; set; }
}
}

22
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Coupons/Dtos/GetCouponListInput.cs

@ -0,0 +1,22 @@
using System;
using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Plugins.Coupons.Coupons.Dtos
{
[Serializable]
public class GetCouponListInput : PagedAndSortedResultRequestDto
{
public bool AvailableOnly { get; set; }
public Guid? StoreId { get; set; }
public Guid? UserId { get; set; }
public bool IncludesExpired { get; set; }
public GetCouponListInput()
{
MaxMaxResultCount = CouponsConsts.MaxNotExpiredCouponQuantityPerUser;
}
}
}

10
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Coupons/Dtos/OccupyCouponInput.cs

@ -0,0 +1,10 @@
using System;
namespace EasyAbp.EShop.Plugins.Coupons.Coupons.Dtos
{
[Serializable]
public class OccupyCouponInput
{
public Guid OrderId { get; set; }
}
}

9
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Coupons/Dtos/UpdateCouponDto.cs

@ -0,0 +1,9 @@
using System;
namespace EasyAbp.EShop.Plugins.Coupons.Coupons.Dtos
{
[Serializable]
public class UpdateCouponDto
{
public DateTime? ExpirationTime { get; set; }
}
}

19
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Coupons/ICouponAppService.cs

@ -0,0 +1,19 @@
using System;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Coupons.Coupons.Dtos;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace EasyAbp.EShop.Plugins.Coupons.Coupons
{
public interface ICouponAppService :
ICrudAppService<
CouponDto,
Guid,
GetCouponListInput,
CreateCouponDto,
UpdateCouponDto>
{
Task<CouponDto> OccupyAsync(Guid id, OccupyCouponInput input);
}
}

16
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/EShopPluginsCouponsApplicationContractsModule.cs

@ -0,0 +1,16 @@
using Volo.Abp.Application;
using Volo.Abp.Modularity;
using Volo.Abp.Authorization;
namespace EasyAbp.EShop.Plugins.Coupons
{
[DependsOn(
typeof(EShopPluginsCouponsDomainSharedModule),
typeof(AbpDddApplicationContractsModule),
typeof(AbpAuthorizationModule)
)]
public class EShopPluginsCouponsApplicationContractsModule : AbpModule
{
}
}

33
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Permissions/CouponsPermissionDefinitionProvider.cs

@ -0,0 +1,33 @@
using EasyAbp.EShop.Plugins.Coupons.Localization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;
namespace EasyAbp.EShop.Plugins.Coupons.Permissions
{
public class CouponsPermissionDefinitionProvider : PermissionDefinitionProvider
{
public override void Define(IPermissionDefinitionContext context)
{
var myGroup = context.AddGroup(CouponsPermissions.GroupName, L("Permission:Coupons"));
var couponTemplatePermission = myGroup.AddPermission(CouponsPermissions.CouponTemplate.Default, L("Permission:CouponTemplate"));
couponTemplatePermission.AddChild(CouponsPermissions.CouponTemplate.CrossStore, L("Permission:CrossStore"));
couponTemplatePermission.AddChild(CouponsPermissions.CouponTemplate.Create, L("Permission:Create"));
couponTemplatePermission.AddChild(CouponsPermissions.CouponTemplate.Update, L("Permission:Update"));
couponTemplatePermission.AddChild(CouponsPermissions.CouponTemplate.Delete, L("Permission:Delete"));
var couponPermission = myGroup.AddPermission(CouponsPermissions.Coupon.Default, L("Permission:Coupon"));
couponPermission.AddChild(CouponsPermissions.Coupon.Use, L("Permission:Use"));
couponPermission.AddChild(CouponsPermissions.Coupon.Manage, L("Permission:Manage"));
couponPermission.AddChild(CouponsPermissions.Coupon.CrossStore, L("Permission:CrossStore"));
couponPermission.AddChild(CouponsPermissions.Coupon.Create, L("Permission:Create"));
couponPermission.AddChild(CouponsPermissions.Coupon.Update, L("Permission:Update"));
couponPermission.AddChild(CouponsPermissions.Coupon.Delete, L("Permission:Delete"));
}
private static LocalizableString L(string name)
{
return LocalizableString.Create<CouponsResource>(name);
}
}
}

34
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Permissions/CouponsPermissions.cs

@ -0,0 +1,34 @@
using Volo.Abp.Reflection;
namespace EasyAbp.EShop.Plugins.Coupons.Permissions
{
public class CouponsPermissions
{
public const string GroupName = "EasyAbp.EShop.Plugins.Coupons";
public static string[] GetAll()
{
return ReflectionHelper.GetPublicConstantsRecursively(typeof(CouponsPermissions));
}
public class CouponTemplate
{
public const string Default = GroupName + ".CouponTemplate";
public const string CrossStore = Default + ".CrossStore";
public const string Update = Default + ".Update";
public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete";
}
public class Coupon
{
public const string Default = GroupName + ".Coupon";
public const string Use = Default + ".Use";
public const string Manage = Default + ".Manage";
public const string CrossStore = Default + ".CrossStore";
public const string Update = Default + ".Update";
public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete";
}
}
}

3
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

18
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application/EasyAbp.EShop.Plugins.Coupons.Application.csproj

@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.AutoMapper" Version="3.1.2" />
<PackageReference Include="Volo.Abp.Ddd.Application" Version="3.1.2" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Stores\src\EasyAbp.EShop.Stores.Application.Shared\EasyAbp.EShop.Stores.Application.Shared.csproj" />
<ProjectReference Include="..\EasyAbp.EShop.Plugins.Coupons.Application.Contracts\EasyAbp.EShop.Plugins.Coupons.Application.Contracts.csproj" />
<ProjectReference Include="..\EasyAbp.EShop.Plugins.Coupons.Domain\EasyAbp.EShop.Plugins.Coupons.Domain.csproj" />
</ItemGroup>
</Project>

114
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/CouponTemplateAppService.cs

@ -0,0 +1,114 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Coupons.Permissions;
using EasyAbp.EShop.Plugins.Coupons.CouponTemplates.Dtos;
using EasyAbp.EShop.Stores.Authorization;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace EasyAbp.EShop.Plugins.Coupons.CouponTemplates
{
public class CouponTemplateAppService : CrudAppService<CouponTemplate, CouponTemplateDto, Guid, PagedAndSortedResultRequestDto, CreateUpdateCouponTemplateDto, CreateUpdateCouponTemplateDto>,
ICouponTemplateAppService
{
protected override string GetPolicyName { get; set; } = CouponsPermissions.CouponTemplate.Default;
protected override string GetListPolicyName { get; set; } = CouponsPermissions.CouponTemplate.Default;
protected override string CreatePolicyName { get; set; } = CouponsPermissions.CouponTemplate.Create;
protected override string UpdatePolicyName { get; set; } = CouponsPermissions.CouponTemplate.Update;
protected override string DeletePolicyName { get; set; } = CouponsPermissions.CouponTemplate.Delete;
private readonly ICouponTemplateRepository _repository;
public CouponTemplateAppService(ICouponTemplateRepository repository) : base(repository)
{
_repository = repository;
}
protected override IQueryable<CouponTemplate> CreateFilteredQuery(PagedAndSortedResultRequestDto input)
{
return _repository.WithDetails();
}
public override async Task<CouponTemplateDto> CreateAsync(CreateUpdateCouponTemplateDto input)
{
await AuthorizationService.CheckMultiStorePolicyAsync(input.StoreId, CreatePolicyName,
CouponsPermissions.CouponTemplate.CrossStore);
if (input.Scopes.Any(x => x.StoreId != input.StoreId))
{
await AuthorizationService.CheckAsync(CouponsPermissions.CouponTemplate.CrossStore);
}
var entity = await MapToEntityAsync(input);
TryToSetTenantId(entity);
foreach (var inputScoreDto in input.Scopes)
{
entity.Scopes.Add(new CouponTemplateScope(GuidGenerator.Create(), inputScoreDto.StoreId,
inputScoreDto.ProductGroupName, inputScoreDto.ProductId, inputScoreDto.ProductSkuId));
}
await Repository.InsertAsync(entity, autoSave: true);
return await MapToGetOutputDtoAsync(entity);
}
public override async Task<CouponTemplateDto> UpdateAsync(Guid id, CreateUpdateCouponTemplateDto input)
{
var entity = await GetEntityByIdAsync(id);
await AuthorizationService.CheckMultiStorePolicyAsync(entity.StoreId, UpdatePolicyName,
CouponsPermissions.CouponTemplate.CrossStore);
if (input.StoreId != entity.StoreId || input.Scopes.Any(x => x.StoreId != input.StoreId))
{
await AuthorizationService.CheckAsync(CouponsPermissions.CouponTemplate.CrossStore);
}
await MapToEntityAsync(input, entity);
foreach (var inputScoreDto in input.Scopes.Where(dto => !ExistScope(entity.Scopes, dto)))
{
entity.Scopes.Add(new CouponTemplateScope(GuidGenerator.Create(), inputScoreDto.StoreId,
inputScoreDto.ProductGroupName, inputScoreDto.ProductId, inputScoreDto.ProductSkuId));
}
entity.Scopes.RemoveAll(scope => !ExistScope(input.Scopes, scope));
await Repository.UpdateAsync(entity, autoSave: true);
return await MapToGetOutputDtoAsync(entity);
}
public override async Task DeleteAsync(Guid id)
{
var couponTemplate = await GetEntityByIdAsync(id);
await AuthorizationService.CheckMultiStorePolicyAsync(couponTemplate.StoreId, DeletePolicyName,
CouponsPermissions.CouponTemplate.CrossStore);
await _repository.DeleteAsync(couponTemplate);
}
protected virtual bool ExistScope(IEnumerable<CreateUpdateCouponTemplateScopeDto> scopes, ICouponTemplateScope need)
{
return scopes.Any(x => x.StoreId == need.StoreId &&
x.ProductGroupName == need.ProductGroupName &&
x.ProductId == need.ProductId &&
x.ProductSkuId == need.ProductSkuId);
}
protected virtual bool ExistScope(IEnumerable<ICouponTemplateScope> scopes, CreateUpdateCouponTemplateScopeDto dto)
{
return scopes.Any(x => x.StoreId == dto.StoreId &&
x.ProductGroupName == dto.ProductGroupName &&
x.ProductId == dto.ProductId &&
x.ProductSkuId == dto.ProductSkuId);
}
}
}

172
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application/EasyAbp/EShop/Plugins/Coupons/Coupons/CouponAppService.cs

@ -0,0 +1,172 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Coupons.Permissions;
using EasyAbp.EShop.Plugins.Coupons.Coupons.Dtos;
using EasyAbp.EShop.Plugins.Coupons.CouponTemplates;
using EasyAbp.EShop.Plugins.Coupons.CouponTemplates.Dtos;
using EasyAbp.EShop.Stores.Authorization;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Authorization;
using Volo.Abp.Users;
namespace EasyAbp.EShop.Plugins.Coupons.Coupons
{
public class CouponAppService : CrudAppService<Coupon, CouponDto, Guid, GetCouponListInput, CreateCouponDto, UpdateCouponDto>,
ICouponAppService
{
protected override string GetPolicyName { get; set; } = CouponsPermissions.Coupon.Default;
protected override string GetListPolicyName { get; set; } = CouponsPermissions.Coupon.Default;
protected override string CreatePolicyName { get; set; } = CouponsPermissions.Coupon.Create;
protected override string UpdatePolicyName { get; set; } = CouponsPermissions.Coupon.Update;
protected override string DeletePolicyName { get; set; } = CouponsPermissions.Coupon.Delete;
private readonly ICouponTemplateRepository _couponTemplateRepository;
private readonly ICouponRepository _repository;
public CouponAppService(
ICouponTemplateRepository couponTemplateRepository,
ICouponRepository repository) : base(repository)
{
_couponTemplateRepository = couponTemplateRepository;
_repository = repository;
}
protected override IQueryable<Coupon> CreateFilteredQuery(GetCouponListInput input)
{
return (input.AvailableOnly ? _repository.GetAvailableCouponQueryable(Clock) : _repository.AsQueryable())
.WhereIf(input.UserId.HasValue, x => x.UserId == input.UserId.Value)
.WhereIf(!input.AvailableOnly && !input.IncludesExpired, x => x.ExpirationTime > Clock.Now);
}
protected virtual CouponDto FillCouponTemplateData(CouponDto couponDto, CouponTemplate couponTemplate)
{
couponDto.CouponTemplate = ObjectMapper.Map<CouponTemplate, CouponTemplateDto>(couponTemplate);
return couponDto;
}
public override async Task<CouponDto> GetAsync(Guid id)
{
await CheckGetPolicyAsync();
var coupon = await GetEntityByIdAsync(id);
var couponTemplate = await _couponTemplateRepository.GetAsync(coupon.CouponTemplateId);
if (coupon.UserId != CurrentUser.GetId())
{
await AuthorizationService.CheckMultiStorePolicyAsync(couponTemplate.StoreId,
CouponsPermissions.Coupon.Manage, CouponsPermissions.Coupon.CrossStore);
}
return FillCouponTemplateData(await MapToGetOutputDtoAsync(coupon), couponTemplate);
}
public override async Task<PagedResultDto<CouponDto>> GetListAsync(GetCouponListInput input)
{
if (input.UserId != CurrentUser.GetId())
{
await AuthorizationService.CheckMultiStorePolicyAsync(input.StoreId,
CouponsPermissions.Coupon.Manage, CouponsPermissions.Coupon.CrossStore);
}
var result = await base.GetListAsync(input);
var couponTemplateDtoDictionary = new Dictionary<Guid, CouponTemplateDto>();
foreach (var couponDto in result.Items)
{
if (!couponTemplateDtoDictionary.ContainsKey(couponDto.CouponTemplateId))
{
couponTemplateDtoDictionary.Add(couponDto.CouponTemplateId,
ObjectMapper.Map<CouponTemplate, CouponTemplateDto>(
await _couponTemplateRepository.GetAsync(couponDto.CouponTemplateId)));
}
couponDto.CouponTemplate = couponTemplateDtoDictionary[couponDto.CouponTemplateId];
}
return result;
}
public override async Task<CouponDto> CreateAsync(CreateCouponDto input)
{
await CheckCreatePolicyAsync();
var couponTemplate = await _couponTemplateRepository.GetAsync(input.CouponTemplateId);
await AuthorizationService.CheckMultiStorePolicyAsync(couponTemplate.StoreId,
CouponsPermissions.Coupon.Manage, CouponsPermissions.Coupon.CrossStore);
var coupon = await MapToEntityAsync(input);
TryToSetTenantId(coupon);
coupon.SetExpirationTime(couponTemplate.GetCalculatedExpirationTime(Clock));
await _repository.InsertAsync(coupon, autoSave: true);
return FillCouponTemplateData(await MapToGetOutputDtoAsync(coupon), couponTemplate);
}
public override async Task<CouponDto> UpdateAsync(Guid id, UpdateCouponDto input)
{
await CheckUpdatePolicyAsync();
var coupon = await GetEntityByIdAsync(id);
var couponTemplate = await _couponTemplateRepository.GetAsync(coupon.CouponTemplateId);
await AuthorizationService.CheckMultiStorePolicyAsync(couponTemplate.StoreId,
CouponsPermissions.Coupon.Manage, CouponsPermissions.Coupon.CrossStore);
await MapToEntityAsync(input, coupon);
await Repository.UpdateAsync(coupon, autoSave: true);
return FillCouponTemplateData(await MapToGetOutputDtoAsync(coupon), couponTemplate);
}
public override async Task DeleteAsync(Guid id)
{
await CheckDeletePolicyAsync();
var coupon = await GetEntityByIdAsync(id);
var couponTemplate = await _couponTemplateRepository.GetAsync(coupon.CouponTemplateId);
await AuthorizationService.CheckMultiStorePolicyAsync(couponTemplate.StoreId,
CouponsPermissions.Coupon.Manage, CouponsPermissions.Coupon.CrossStore);
await _repository.DeleteAsync(coupon, true);
}
[Authorize(CouponsPermissions.Coupon.Use)]
public virtual async Task<CouponDto> OccupyAsync(Guid id, OccupyCouponInput input)
{
var coupon = await GetEntityByIdAsync(id);
if (coupon.UserId != CurrentUser.GetId())
{
throw new AbpAuthorizationException();
}
if (coupon.OrderId.HasValue)
{
throw new CouponHasBeenOccupiedException();
}
var couponTemplate = await _couponTemplateRepository.GetAsync(coupon.CouponTemplateId);
coupon.SetOrderId(input.OrderId);
await _repository.UpdateAsync(coupon, true);
return FillCouponTemplateData(await MapToGetOutputDtoAsync(coupon), couponTemplate);
}
}
}

14
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application/EasyAbp/EShop/Plugins/Coupons/CouponsAppService.cs

@ -0,0 +1,14 @@
using EasyAbp.EShop.Plugins.Coupons.Localization;
using Volo.Abp.Application.Services;
namespace EasyAbp.EShop.Plugins.Coupons
{
public abstract class CouponsAppService : ApplicationService
{
protected CouponsAppService()
{
LocalizationResource = typeof(CouponsResource);
ObjectMapperContext = typeof(EShopPluginsCouponsApplicationModule);
}
}
}

30
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application/EasyAbp/EShop/Plugins/Coupons/CouponsApplicationAutoMapperProfile.cs

@ -0,0 +1,30 @@
using EasyAbp.EShop.Plugins.Coupons.CouponTemplates;
using EasyAbp.EShop.Plugins.Coupons.CouponTemplates.Dtos;
using EasyAbp.EShop.Plugins.Coupons.Coupons;
using EasyAbp.EShop.Plugins.Coupons.Coupons.Dtos;
using AutoMapper;
using Volo.Abp.AutoMapper;
namespace EasyAbp.EShop.Plugins.Coupons
{
public class CouponsApplicationAutoMapperProfile : Profile
{
public CouponsApplicationAutoMapperProfile()
{
/* You can configure your AutoMapper mapping configuration here.
* Alternatively, you can split your mapping configurations
* into multiple profile classes for a better organization. */
CreateMap<CouponTemplate, CouponTemplateDto>();
CreateMap<CreateUpdateCouponTemplateDto, CouponTemplate>(MemberList.Source)
.Ignore(x => x.Scopes);
CreateMap<CouponTemplateScope, CouponTemplateScopeDto>();
CreateMap<CreateUpdateCouponTemplateScopeDto, CouponTemplateScope>(MemberList.Source);
CreateMap<Coupon, CouponDto>()
.Ignore(x => x.CouponTemplate);
CreateMap<CreateCouponDto, Coupon>(MemberList.Source);
CreateMap<UpdateCouponDto, Coupon>(MemberList.Source);
}
}
}

27
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application/EasyAbp/EShop/Plugins/Coupons/EShopPluginsCouponsApplicationModule.cs

@ -0,0 +1,27 @@
using EasyAbp.EShop.Stores;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AutoMapper;
using Volo.Abp.Modularity;
using Volo.Abp.Application;
namespace EasyAbp.EShop.Plugins.Coupons
{
[DependsOn(
typeof(EShopPluginsCouponsDomainModule),
typeof(EShopPluginsCouponsApplicationContractsModule),
typeof(EShopStoresApplicationSharedModule),
typeof(AbpDddApplicationModule),
typeof(AbpAutoMapperModule)
)]
public class EShopPluginsCouponsApplicationModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAutoMapperObjectMapper<EShopPluginsCouponsApplicationModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddMaps<EShopPluginsCouponsApplicationModule>(validate: true);
});
}
}
}

3
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

25
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp.EShop.Plugins.Coupons.Domain.Shared.csproj

@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Validation" Version="3.1.2" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Stores\src\EasyAbp.EShop.Stores.Domain.Shared\EasyAbp.EShop.Stores.Domain.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="3.1.6" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="EasyAbp\EShop\Plugins\Coupons\Localization\*.json" />
<Content Remove="EasyAbp\EShop\Plugins\Coupons\Localization\*.json" />
</ItemGroup>
</Project>

36
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/CouponTemplateData.cs

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
namespace EasyAbp.EShop.Plugins.Coupons.CouponTemplates
{
public class CouponTemplateData : ICouponTemplate, IHasCouponTemplateScopes<CouponTemplateScopeData>
{
public Guid Id { get; set; }
public Guid? TenantId { get; set; }
public Guid? StoreId { get; set; }
public CouponType CouponType { get; set; }
public string UniqueName { get; set; }
public string DisplayName { get; set; }
public string Description { get; set; }
public TimeSpan? UsableDuration { get; set; }
public DateTime? UsableBeginTime { get; set; }
public DateTime? UsableEndTime { get; set; }
public decimal ConditionAmount { get; set; }
public decimal DiscountAmount { get; set; }
public bool IsUnscoped { get; set; }
public List<CouponTemplateScopeData> Scopes { get; set; }
}
}

15
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/CouponTemplateScopeData.cs

@ -0,0 +1,15 @@
using System;
namespace EasyAbp.EShop.Plugins.Coupons.CouponTemplates
{
public class CouponTemplateScopeData : ICouponTemplateScope
{
public Guid StoreId { get; set; }
public string ProductGroupName { get; set; }
public Guid? ProductId { get; set; }
public Guid? ProductSkuId { get; set; }
}
}

27
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/CouponType.cs

@ -0,0 +1,27 @@
using System;
namespace EasyAbp.EShop.Plugins.Coupons.CouponTemplates
{
[Flags]
public enum CouponType
{
/// <summary>
/// Discount once if the condition is met.
/// e.g. arrange ConditionAmount = 300 and DiscountAmount = 20.
/// If the price of a product is 300, the actual order price will be discounted by 20.
/// </summary>
Normal = 1,
/// <summary>
/// Discount every time the condition is met.
/// e.g. arrange ConditionAmount = 300 and DiscountAmount = 20.
/// If the price of a product is 300, the actual order price will be discounted by 60.
/// </summary>
PerMeet = 2,
/// <summary>
/// A type of coupon with custom usage rules.
/// </summary>
Custom = 4
}
}

34
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/ICouponTemplate.cs

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
namespace EasyAbp.EShop.Plugins.Coupons.CouponTemplates
{
public interface ICouponTemplate
{
Guid? StoreId { get; }
CouponType CouponType { get; }
[CanBeNull]
string UniqueName { get; }
[NotNull]
string DisplayName { get; }
[CanBeNull]
string Description { get; }
TimeSpan? UsableDuration { get; }
DateTime? UsableBeginTime { get; }
DateTime? UsableEndTime { get; }
decimal ConditionAmount { get; }
decimal DiscountAmount { get; }
bool IsUnscoped { get; }
}
}

11
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/ICouponTemplateLookupService.cs

@ -0,0 +1,11 @@
using System;
using System.Threading;
using System.Threading.Tasks;
namespace EasyAbp.EShop.Plugins.Coupons.CouponTemplates
{
public interface ICouponTemplateLookupService
{
Task<CouponTemplateData> FindByIdAsync(Guid id, CancellationToken cancellationToken = default);
}
}

16
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/ICouponTemplateScope.cs

@ -0,0 +1,16 @@
using System;
using EasyAbp.EShop.Stores.Stores;
using JetBrains.Annotations;
namespace EasyAbp.EShop.Plugins.Coupons.CouponTemplates
{
public interface ICouponTemplateScope : IMultiStore
{
[CanBeNull]
string ProductGroupName { get; }
Guid? ProductId { get; }
Guid? ProductSkuId { get; }
}
}

11
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/IHasCouponTemplateScopes.cs

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
namespace EasyAbp.EShop.Plugins.Coupons.CouponTemplates
{
public interface IHasCouponTemplateScopes<T> where T : ICouponTemplateScope
{
List<T> Scopes { get; }
}
}

25
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/Coupons/CouponData.cs

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using EasyAbp.EShop.Plugins.Coupons.CouponTemplates;
namespace EasyAbp.EShop.Plugins.Coupons.Coupons
{
public class CouponData : ICoupon
{
public Guid Id { get; set; }
public Guid? TenantId { get; set; }
public Guid CouponTemplateId { get; set; }
public Guid UserId { get; set; }
public Guid? OrderId { get; set; }
public DateTime? ExpirationTime { get; set; }
public DateTime? UsedTime { get; set; }
public decimal? DiscountedAmount { get; set; }
}
}

19
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/Coupons/ICoupon.cs

@ -0,0 +1,19 @@
using System;
namespace EasyAbp.EShop.Plugins.Coupons.Coupons
{
public interface ICoupon
{
Guid CouponTemplateId { get; }
Guid UserId { get; }
Guid? OrderId { get; }
DateTime? ExpirationTime { get; }
DateTime? UsedTime { get; }
decimal? DiscountedAmount { get; }
}
}

11
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/Coupons/ICouponLookupService.cs

@ -0,0 +1,11 @@
using System;
using System.Threading;
using System.Threading.Tasks;
namespace EasyAbp.EShop.Plugins.Coupons.Coupons
{
public interface ICouponLookupService
{
Task<CouponData> FindByIdAsync(Guid id, CancellationToken cancellationToken = default);
}
}

11
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponsConsts.cs

@ -0,0 +1,11 @@
namespace EasyAbp.EShop.Plugins.Coupons
{
public static class CouponsConsts
{
public const string OrderCouponIdPropertyName = "CouponId";
public const string OrderCouponDiscountAmountPropertyName = "CouponDiscountAmount";
public const int MaxNotExpiredCouponQuantityPerUser = 100;
}
}

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

Loading…
Cancel
Save