Browse Source

Implement order refund feature

Close #85
pull/96/head 0.11.0
gdlcf88 6 years ago
parent
commit
a3919980f3
  1. 2
      common.props
  2. 2
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp.EShop.Orders.Domain.csproj
  3. 2
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderLine.cs
  4. 15
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderRefundCompletedEventHandler.cs
  5. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp.EShop.Payments.Application.Contracts.csproj
  6. 6
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/Dtos/PaymentDto.cs
  7. 8
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/Dtos/PaymentItemDto.cs
  8. 4
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Refunds/Dtos/RefundDto.cs
  9. 33
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Refunds/Dtos/RefundItemDto.cs
  10. 14
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Refunds/Dtos/RefundItemOrderLineDto.cs
  11. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/PaymentsApplicationAutoMapperProfile.cs
  12. 13
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/OrderIsNotInSpecifiedPaymentException.cs
  13. 11
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/RefundAppService.cs
  14. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp.EShop.Payments.Domain.Shared.csproj
  15. 7
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Refunds/OrderRefundCompletedEto.cs
  16. 4
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Refunds/OrderRefundEto.cs
  17. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Refunds/OrderRefundItemEto.cs
  18. 10
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/EShopPaymentsDomainModule.cs
  19. 5
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Payments/PaymentItem.cs
  20. 6
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Payments/PaymentSynchronizer.cs
  21. 6
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/PaymentsDomainAutoMapperProfile.cs
  22. 6
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Refunds/Refund.cs
  23. 4
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Refunds/RefundItem.cs
  24. 88
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Refunds/RefundSynchronizer.cs
  25. 5
      samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSample.Application.Contracts.csproj
  26. 4
      samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSampleApplicationContractsModule.cs
  27. 5
      samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSample.Application.csproj
  28. 4
      samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSampleApplicationModule.cs
  29. 3
      samples/EShopSample/aspnet-core/src/EShopSample.DbMigrator/appsettings.json
  30. 5
      samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSample.Domain.Shared.csproj
  31. 4
      samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSampleDomainSharedModule.cs
  32. 10
      samples/EShopSample/aspnet-core/src/EShopSample.Domain/DefaultAccountGroup.cs
  33. 13
      samples/EShopSample/aspnet-core/src/EShopSample.Domain/EShopSample.Domain.csproj
  34. 20
      samples/EShopSample/aspnet-core/src/EShopSample.Domain/EShopSampleDomainModule.cs
  35. 2
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EShopSampleMigrationsDbContext.cs
  36. 4183
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200826141904_AddedPrepaymentModule.Designer.cs
  37. 86
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200826141904_AddedPrepaymentModule.cs
  38. 4180
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200826214249_RemovedCurrencyFromPaymentItem.Designer.cs
  39. 23
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200826214249_RemovedCurrencyFromPaymentItem.cs
  40. 139
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/EShopSampleMigrationsDbContextModelSnapshot.cs
  41. 5
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore/EShopSample.EntityFrameworkCore.csproj
  42. 4
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore/EntityFrameworkCore/EShopSampleEntityFrameworkCoreModule.cs
  43. 5
      samples/EShopSample/aspnet-core/src/EShopSample.HttpApi.Client/EShopSample.HttpApi.Client.csproj
  44. 4
      samples/EShopSample/aspnet-core/src/EShopSample.HttpApi.Client/EShopSampleHttpApiClientModule.cs
  45. 5
      samples/EShopSample/aspnet-core/src/EShopSample.HttpApi/EShopSample.HttpApi.csproj
  46. 4
      samples/EShopSample/aspnet-core/src/EShopSample.HttpApi/EShopSampleHttpApiModule.cs
  47. 5
      samples/EShopSample/aspnet-core/src/EShopSample.Web/EShopSample.Web.csproj
  48. 16
      samples/EShopSample/aspnet-core/src/EShopSample.Web/EShopSampleWebModule.cs

2
common.props

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

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

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

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

@ -89,7 +89,7 @@ namespace EasyAbp.EShop.Orders.Orders
internal void Refund(int quantity, decimal amount)
{
RefundedQuantity -= quantity;
RefundedQuantity += quantity;
RefundAmount += amount;
}
}

15
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderRefundEventHandler.cs → modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderRefundCompletedEventHandler.cs

@ -3,23 +3,30 @@ using EasyAbp.EShop.Payments.Refunds;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Uow;
namespace EasyAbp.EShop.Orders.Orders
{
public class OrderRefundEventHandler : IDistributedEventHandler<EntityCreatedEto<EShopRefundEto>>, ITransientDependency
public class OrderRefundCompletedEventHandler : IDistributedEventHandler<OrderRefundCompletedEto>, ITransientDependency
{
private readonly ICurrentTenant _currentTenant;
private readonly IOrderRepository _orderRepository;
public OrderRefundEventHandler(IOrderRepository orderRepository)
public OrderRefundCompletedEventHandler(
ICurrentTenant currentTenant,
IOrderRepository orderRepository)
{
_currentTenant = currentTenant;
_orderRepository = orderRepository;
}
[UnitOfWork(true)]
public virtual async Task HandleEventAsync(EntityCreatedEto<EShopRefundEto> eventData)
public virtual async Task HandleEventAsync(OrderRefundCompletedEto eventData)
{
foreach (var refundItem in eventData.Entity.RefundItems)
using var changeTenant = _currentTenant.Change(eventData.Refund.TenantId);
foreach (var refundItem in eventData.Refund.RefundItems)
{
var order = await _orderRepository.GetAsync(refundItem.OrderId);

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

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

6
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/Dtos/PaymentDto.cs

@ -7,6 +7,8 @@ namespace EasyAbp.EShop.Payments.Payments.Dtos
{
public class PaymentDto : ExtensibleFullAuditedEntityDto<Guid>, IPayment
{
#region Base properties
public Guid UserId { get; set; }
public string PaymentMethod { get; set; }
@ -30,7 +32,9 @@ namespace EasyAbp.EShop.Payments.Payments.Dtos
public DateTime? CompletionTime { get; set; }
public DateTime? CanceledTime { get; set; }
#endregion
public List<PaymentItemDto> PaymentItems { get; set; }
}
}

8
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Payments/Dtos/PaymentItemDto.cs

@ -7,14 +7,12 @@ namespace EasyAbp.EShop.Payments.Payments.Dtos
{
public class PaymentItemDto : ExtensibleFullAuditedEntityDto<Guid>, IPaymentItem
{
public Guid StoreId { get; set; }
#region Base properties
public string ItemType { get; set; }
public string ItemKey { get; set; }
public string Currency { get; set; }
public decimal OriginalPaymentAmount { get; set; }
public decimal PaymentDiscount { get; set; }
@ -24,5 +22,9 @@ namespace EasyAbp.EShop.Payments.Payments.Dtos
public decimal RefundAmount { get; set; }
public decimal PendingRefundAmount { get; set; }
#endregion
public Guid StoreId { get; set; }
}
}

4
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Refunds/Dtos/RefundDto.cs

@ -7,6 +7,8 @@ namespace EasyAbp.EShop.Payments.Refunds.Dtos
{
public class RefundDto : FullAuditedEntityDto<Guid>, IRefund
{
#region Base properties
public Guid PaymentId { get; set; }
public string RefundPaymentMethod { get; set; }
@ -27,6 +29,8 @@ namespace EasyAbp.EShop.Payments.Refunds.Dtos
public DateTime? CanceledTime { get; set; }
#endregion
public List<RefundItemDto> RefundItems { get; set; }
}
}

33
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Refunds/Dtos/RefundItemDto.cs

@ -1,31 +1,28 @@
using System;
using EasyAbp.PaymentService.Payments;
using System.Collections.Generic;
using EasyAbp.PaymentService.Refunds;
using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Payments.Refunds.Dtos
{
public class RefundItemDto : ExtensibleFullAuditedEntityDto<Guid>, IRefund
public class RefundItemDto : ExtensibleFullAuditedEntityDto<Guid>, IRefundItem
{
public virtual Guid PaymentId { get; set; }
#region Base properties
public virtual string RefundPaymentMethod { get; set; }
public Guid PaymentItemId { get; set; }
public virtual string ExternalTradingCode { get; set; }
public decimal RefundAmount { get; set; }
public virtual string Currency { get; set; }
public virtual decimal RefundAmount { get; set; }
public virtual string DisplayReason { get; set; }
public virtual string CustomerRemark { get; set; }
public virtual string StaffRemark { get; set; }
public virtual DateTime? CompletedTime { get; set; }
public virtual DateTime? CanceledTime { get; set; }
public string CustomerRemark { get; set; }
public string StaffRemark { get; set; }
#endregion
public Guid StoreId { get; set; }
public Guid OrderId { get; set; }
public List<RefundItemOrderLineDto> RefundItemOrderLines { get; set; }
}
}

14
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Refunds/Dtos/RefundItemOrderLineDto.cs

@ -0,0 +1,14 @@
using System;
namespace EasyAbp.EShop.Payments.Refunds.Dtos
{
[Serializable]
public class RefundItemOrderLineDto
{
public Guid OrderLineId { get; set; }
public int RefundedQuantity { get; set; }
public decimal RefundAmount { get; set; }
}
}

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

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

13
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/OrderIsNotInSpecifiedPaymentException.cs

@ -0,0 +1,13 @@
using System;
using Volo.Abp;
namespace EasyAbp.EShop.Payments.Refunds
{
public class OrderIsNotInSpecifiedPaymentException : BusinessException
{
public OrderIsNotInSpecifiedPaymentException(Guid orderId, Guid paymentId)
: base("OrderIsNotInSpecifiedPayment", $"The order ({orderId}) is not in the specified payment ({paymentId}).")
{
}
}
}

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

@ -81,6 +81,8 @@ namespace EasyAbp.EShop.Payments.Refunds
public virtual async Task CreateAsync(CreateEShopRefundInput input)
{
await AuthorizationService.CheckAsync(PaymentsPermissions.Refunds.Manage);
var payment = await _paymentRepository.GetAsync(input.PaymentId);
var createRefundInput = new CreateRefundInput
{
@ -94,6 +96,13 @@ namespace EasyAbp.EShop.Payments.Refunds
{
var order = await _orderAppService.GetAsync(refundItem.OrderId);
var paymentItem = payment.PaymentItems.SingleOrDefault(x => x.ItemKey == refundItem.OrderId.ToString());
if (order.PaymentId != input.PaymentId || paymentItem == null)
{
throw new OrderIsNotInSpecifiedPaymentException(order.Id, payment.Id);
}
// Todo: Check if current user is an admin of the store.
foreach (var orderLineRefundInfoModel in refundItem.OrderLines)
@ -108,7 +117,7 @@ namespace EasyAbp.EShop.Payments.Refunds
createRefundInput.RefundItems.Add(new CreateRefundItemInput
{
PaymentItemId = refundItem.OrderId,
PaymentItemId = paymentItem.Id,
RefundAmount = refundItem.OrderLines.Sum(x => x.TotalAmount),
CustomerRemark = refundItem.CustomerRemark,
StaffRemark = refundItem.StaffRemark,

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

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

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

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

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

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

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

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

10
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/EShopPaymentsDomainModule.cs

@ -17,16 +17,6 @@ namespace EasyAbp.EShop.Payments
)]
public class EShopPaymentsDomainModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpDistributedEntityEventOptions>(options =>
{
options.EtoMappings.Add<Refund, RefundEto>(typeof(EShopPaymentsDomainModule));
options.AutoEventSelectors.Add<Refund>();
});
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAutoMapperObjectMapper<EShopPaymentsDomainModule>();

5
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Payments/PaymentItem.cs

@ -16,10 +16,7 @@ namespace EasyAbp.EShop.Payments.Payments
public virtual string ItemType { get; protected set; }
public virtual string ItemKey { get; protected set; }
[NotNull]
public virtual string Currency { get; protected set; }
public virtual decimal OriginalPaymentAmount { get; protected set; }
public virtual decimal PaymentDiscount { get; protected set; }

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

@ -7,6 +7,7 @@ using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.MultiTenancy;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Uow;
@ -19,19 +20,24 @@ namespace EasyAbp.EShop.Payments.Payments
ITransientDependency
{
private readonly IObjectMapper _objectMapper;
private readonly ICurrentTenant _currentTenant;
private readonly IPaymentRepository _paymentRepository;
public PaymentSynchronizer(
IObjectMapper objectMapper,
ICurrentTenant currentTenant,
IPaymentRepository paymentRepository)
{
_objectMapper = objectMapper;
_currentTenant = currentTenant;
_paymentRepository = paymentRepository;
}
[UnitOfWork(true)]
public virtual async Task HandleEventAsync(EntityUpdatedEto<PaymentEto> eventData)
{
using var changeTenant = _currentTenant.Change(eventData.Entity.TenantId);
var payment = await _paymentRepository.FindAsync(eventData.Entity.Id);
if (payment == null)

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

@ -23,7 +23,11 @@ namespace EasyAbp.EShop.Payments
CreateMap<RefundEto, Refund>(MemberList.Source)
.Ignore(x => x.RefundItems);
CreateMap<RefundItemEto, RefundItem>(MemberList.Source)
.Ignore(x => x.StoreId);
.Ignore(x => x.StoreId)
.Ignore(x => x.OrderId);
CreateMap<Refund, OrderRefundEto>();
CreateMap<RefundItem, OrderRefundItemEto>();
CreateMap<RefundItemOrderLine, RefundItemOrderLineEto>();
}
}
}

6
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Refunds/Refund.cs

@ -1,13 +1,11 @@
using System;
using System.Collections.Generic;
using AutoMapper;
using EasyAbp.PaymentService.Refunds;
using JetBrains.Annotations;
using Volo.Abp.Domain.Entities.Auditing;
namespace EasyAbp.EShop.Payments.Refunds
{
[AutoMap(typeof(EShopRefundEto))]
public class Refund : FullAuditedAggregateRoot<Guid>, IRefund
{
#region Base properties
@ -39,10 +37,10 @@ namespace EasyAbp.EShop.Payments.Refunds
public virtual DateTime? CanceledTime { get; protected set; }
public virtual List<RefundItem> RefundItems { get; protected set; }
#endregion
public virtual List<RefundItem> RefundItems { get; protected set; }
private Refund()
{

4
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Refunds/RefundItem.cs

@ -1,16 +1,12 @@
using System;
using System.Collections.Generic;
using AutoMapper;
using EasyAbp.EShop.Stores.Stores;
using EasyAbp.PaymentService.Refunds;
using JetBrains.Annotations;
using Volo.Abp.Data;
using Volo.Abp.Domain.Entities.Auditing;
namespace EasyAbp.EShop.Payments.Refunds
{
[AutoMap(typeof(EShopRefundItemEto))]
public class RefundItem : FullAuditedEntity<Guid>, IRefundItem, IMultiStore, IHasExtraProperties
{
#region Base properties

88
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Refunds/RefundSynchronizer.cs

@ -9,50 +9,80 @@ using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.Guids;
using Volo.Abp.Json;
using Volo.Abp.MultiTenancy;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Uow;
namespace EasyAbp.EShop.Payments.Refunds
{
public class RefundSynchronizer :
IDistributedEventHandler<EntityUpdatedEto<EShopRefundEto>>,
IDistributedEventHandler<EntityDeletedEto<EShopRefundEto>>,
IDistributedEventHandler<EntityUpdatedEto<RefundEto>>,
IDistributedEventHandler<EntityDeletedEto<RefundEto>>,
IRefundSynchronizer,
ITransientDependency
{
private readonly IObjectMapper _objectMapper;
private readonly ICurrentTenant _currentTenant;
private readonly IGuidGenerator _guidGenerator;
private readonly IJsonSerializer _jsonSerializer;
private readonly IUnitOfWorkManager _unitOfWorkManager;
private readonly IDistributedEventBus _distributedEventBus;
private readonly IRefundRepository _refundRepository;
public RefundSynchronizer(
IObjectMapper objectMapper,
ICurrentTenant currentTenant,
IGuidGenerator guidGenerator,
IJsonSerializer jsonSerializer,
IUnitOfWorkManager unitOfWorkManager,
IDistributedEventBus distributedEventBus,
IRefundRepository refundRepository)
{
_objectMapper = objectMapper;
_currentTenant = currentTenant;
_guidGenerator = guidGenerator;
_jsonSerializer = jsonSerializer;
_unitOfWorkManager = unitOfWorkManager;
_distributedEventBus = distributedEventBus;
_refundRepository = refundRepository;
}
[UnitOfWork(true)]
public virtual async Task HandleEventAsync(EntityUpdatedEto<EShopRefundEto> eventData)
public virtual async Task HandleEventAsync(EntityUpdatedEto<RefundEto> eventData)
{
using var changeTenant = _currentTenant.Change(eventData.Entity.TenantId);
var publishOrderRefundCompletedEvent = false;
var refund = await _refundRepository.FindAsync(eventData.Entity.Id);
if (refund == null)
{
refund = _objectMapper.Map<EShopRefundEto, Refund>(eventData.Entity);
refund = _objectMapper.Map<RefundEto, Refund>(eventData.Entity);
refund.SetRefundItems(
_objectMapper.Map<List<EShopRefundItemEto>, List<RefundItem>>(eventData.Entity.RefundItems));
_objectMapper.Map<List<RefundItemEto>, List<RefundItem>>(eventData.Entity.RefundItems));
refund.RefundItems.ForEach(item =>
{
FillRefundItemStoreId(item);
FillRefundItemOrderId(item);
});
if (refund.CompletedTime.HasValue)
{
publishOrderRefundCompletedEvent = true;
}
await _refundRepository.InsertAsync(refund, true);
}
else
{
if (eventData.Entity.CompletedTime.HasValue && !refund.CompletedTime.HasValue)
{
publishOrderRefundCompletedEvent = true;
}
_objectMapper.Map(eventData.Entity, refund);
foreach (var etoItem in eventData.Entity.RefundItems)
@ -61,27 +91,17 @@ namespace EasyAbp.EShop.Payments.Refunds
if (item == null)
{
if (!Guid.TryParse(etoItem.GetProperty<string>("StoreId"), out var storeId))
{
throw new StoreIdNotFoundException();
}
if (!Guid.TryParse(etoItem.GetProperty<string>("OrderId"), out var orderId))
{
throw new OrderIdNotFoundException();
}
item = _objectMapper.Map<RefundItemEto, RefundItem>(etoItem);
item = _objectMapper.Map<EShopRefundItemEto, RefundItem>(etoItem);
item.SetStoreId(storeId);
item.SetOrderId(orderId);
refund.RefundItems.Add(item);
}
else
{
_objectMapper.Map(etoItem, item);
}
FillRefundItemStoreId(item);
FillRefundItemOrderId(item);
}
var etoRefundItemIds = eventData.Entity.RefundItems.Select(i => i.Id).ToList();
@ -117,9 +137,37 @@ namespace EasyAbp.EShop.Payments.Refunds
}
await _refundRepository.UpdateAsync(refund, true);
var orderRefundEto = _objectMapper.Map<Refund, OrderRefundEto>(refund);
if (publishOrderRefundCompletedEvent)
{
_unitOfWorkManager.Current.OnCompleted(async () =>
await _distributedEventBus.PublishAsync(new OrderRefundCompletedEto {Refund = orderRefundEto}));
}
}
public virtual async Task HandleEventAsync(EntityDeletedEto<EShopRefundEto> eventData)
protected virtual void FillRefundItemStoreId(RefundItem item)
{
if (!Guid.TryParse(item.GetProperty<string>("StoreId"), out var storeId))
{
throw new StoreIdNotFoundException();
}
item.SetStoreId(storeId);
}
protected virtual void FillRefundItemOrderId(RefundItem item)
{
if (!Guid.TryParse(item.GetProperty<string>("OrderId"), out var orderId))
{
throw new OrderIdNotFoundException();
}
item.SetOrderId(orderId);
}
public virtual async Task HandleEventAsync(EntityDeletedEto<RefundEto> eventData)
{
var refund = await _refundRepository.FindAsync(eventData.Entity.Id);

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

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

4
samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSampleApplicationContractsModule.cs

@ -1,6 +1,7 @@
using EasyAbp.EShop;
using EasyAbp.EShop.Plugins.Baskets;
using EasyAbp.PaymentService;
using EasyAbp.PaymentService.Prepayment;
using EasyAbp.PaymentService.WeChatPay;
using Volo.Abp.Account;
using Volo.Abp.FeatureManagement;
@ -23,7 +24,8 @@ namespace EShopSample
typeof(EShopApplicationContractsModule),
typeof(EShopPluginsBasketsApplicationContractsModule),
typeof(PaymentServiceApplicationContractsModule),
typeof(PaymentServiceWeChatPayApplicationContractsModule)
typeof(PaymentServiceWeChatPayApplicationContractsModule),
typeof(PaymentServicePrepaymentApplicationContractsModule)
)]
public class EShopSampleApplicationContractsModule : AbpModule
{

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

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

4
samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSampleApplicationModule.cs

@ -1,6 +1,7 @@
using EasyAbp.EShop;
using EasyAbp.EShop.Plugins.Baskets;
using EasyAbp.PaymentService;
using EasyAbp.PaymentService.Prepayment;
using EasyAbp.PaymentService.WeChatPay;
using Volo.Abp.Account;
using Volo.Abp.AutoMapper;
@ -23,7 +24,8 @@ namespace EShopSample
typeof(EShopApplicationModule),
typeof(EShopPluginsBasketsApplicationModule),
typeof(PaymentServiceApplicationModule),
typeof(PaymentServiceWeChatPayApplicationModule)
typeof(PaymentServiceWeChatPayApplicationModule),
typeof(PaymentServicePrepaymentApplicationModule)
)]
public class EShopSampleApplicationModule : AbpModule
{

3
samples/EShopSample/aspnet-core/src/EShopSample.DbMigrator/appsettings.json

@ -1,6 +1,7 @@
{
"ConnectionStrings": {
"Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=EShopSample;Trusted_Connection=True;MultipleActiveResultSets=true"
"Default": "Server=60.208.32.153;Database=fenghui01test;User Id=fenghui01test;Password=WYSytJdMORYnhTYmvf;Trusted_Connection=True;Integrated Security=false"
},
"IdentityServer": {
"Clients": {

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

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

4
samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSampleDomainSharedModule.cs

@ -1,6 +1,7 @@
using EasyAbp.EShop;
using EasyAbp.EShop.Plugins.Baskets;
using EasyAbp.PaymentService;
using EasyAbp.PaymentService.Prepayment;
using EasyAbp.PaymentService.WeChatPay;
using EShopSample.Localization;
using Volo.Abp.AuditLogging;
@ -30,7 +31,8 @@ namespace EShopSample
typeof(EShopDomainSharedModule),
typeof(EShopPluginsBasketsDomainSharedModule),
typeof(PaymentServiceDomainSharedModule),
typeof(PaymentServiceWeChatPayDomainSharedModule)
typeof(PaymentServiceWeChatPayDomainSharedModule),
typeof(PaymentServicePrepaymentDomainSharedModule)
)]
public class EShopSampleDomainSharedModule : AbpModule
{

10
samples/EShopSample/aspnet-core/src/EShopSample.Domain/DefaultAccountGroup.cs

@ -0,0 +1,10 @@
using EasyAbp.PaymentService.Prepayment.Options.AccountGroups;
namespace EShopSample
{
[AccountGroupName("default")]
public class DefaultAccountGroup
{
}
}

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

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

20
samples/EShopSample/aspnet-core/src/EShopSample.Domain/EShopSampleDomainModule.cs

@ -2,6 +2,9 @@
using EasyAbp.EShop.Plugins.Baskets;
using EasyAbp.PaymentService;
using EasyAbp.PaymentService.Payments;
using EasyAbp.PaymentService.Prepayment;
using EasyAbp.PaymentService.Prepayment.Options;
using EasyAbp.PaymentService.Prepayment.PaymentService;
using EasyAbp.PaymentService.WeChatPay;
using EShopSample.MultiTenancy;
using EShopSample.ObjectExtending;
@ -35,7 +38,8 @@ namespace EShopSample
typeof(EShopDomainModule),
typeof(EShopPluginsBasketsDomainModule),
typeof(PaymentServiceDomainModule),
typeof(PaymentServiceWeChatPayDomainModule)
typeof(PaymentServiceWeChatPayDomainModule),
typeof(PaymentServicePrepaymentDomainModule)
)]
public class EShopSampleDomainModule : AbpModule
{
@ -50,6 +54,8 @@ namespace EShopSample
{
options.IsEnabled = MultiTenancyConsts.IsEnabled;
});
ConfigurePaymentServicePrepayment();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
@ -58,6 +64,18 @@ namespace EShopSample
resolver.TryRegisterProvider(FreePaymentServiceProvider.PaymentMethod, typeof(FreePaymentServiceProvider));
resolver.TryRegisterProvider(WeChatPayPaymentServiceProvider.PaymentMethod, typeof(WeChatPayPaymentServiceProvider));
resolver.TryRegisterProvider(PrepaymentPaymentServiceProvider.PaymentMethod, typeof(PrepaymentPaymentServiceProvider));
}
private void ConfigurePaymentServicePrepayment()
{
Configure<PaymentServicePrepaymentOptions>(options =>
{
options.AccountGroups.Configure<DefaultAccountGroup>(accountGroup =>
{
accountGroup.Currency = "CNY";
});
});
}
}
}

2
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EShopSampleMigrationsDbContext.cs

@ -1,6 +1,7 @@
using EasyAbp.EShop.EntityFrameworkCore;
using EasyAbp.EShop.Plugins.Baskets.EntityFrameworkCore;
using EasyAbp.PaymentService.EntityFrameworkCore;
using EasyAbp.PaymentService.Prepayment.EntityFrameworkCore;
using EasyAbp.PaymentService.WeChatPay.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
@ -53,6 +54,7 @@ namespace EShopSample.EntityFrameworkCore
builder.ConfigurePaymentService();
builder.ConfigurePaymentServiceWeChatPay();
builder.ConfigurePaymentServicePrepayment();
}
}
}

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

File diff suppressed because it is too large

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

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

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

File diff suppressed because it is too large

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

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

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

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

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

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

4
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore/EntityFrameworkCore/EShopSampleEntityFrameworkCoreModule.cs

@ -1,6 +1,7 @@
using EasyAbp.EShop.EntityFrameworkCore;
using EasyAbp.EShop.Plugins.Baskets.EntityFrameworkCore;
using EasyAbp.PaymentService.EntityFrameworkCore;
using EasyAbp.PaymentService.Prepayment.EntityFrameworkCore;
using EasyAbp.PaymentService.WeChatPay.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
@ -31,7 +32,8 @@ namespace EShopSample.EntityFrameworkCore
typeof(EShopEntityFrameworkCoreModule),
typeof(EShopPluginsBasketsEntityFrameworkCoreModule),
typeof(PaymentServiceEntityFrameworkCoreModule),
typeof(PaymentServiceWeChatPayEntityFrameworkCoreModule)
typeof(PaymentServiceWeChatPayEntityFrameworkCoreModule),
typeof(PaymentServicePrepaymentEntityFrameworkCoreModule)
)]
public class EShopSampleEntityFrameworkCoreModule : AbpModule
{

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

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

4
samples/EShopSample/aspnet-core/src/EShopSample.HttpApi.Client/EShopSampleHttpApiClientModule.cs

@ -1,6 +1,7 @@
using EasyAbp.EShop;
using EasyAbp.EShop.Plugins.Baskets;
using EasyAbp.PaymentService;
using EasyAbp.PaymentService.Prepayment;
using EasyAbp.PaymentService.WeChatPay;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Account;
@ -22,7 +23,8 @@ namespace EShopSample
typeof(EShopHttpApiClientModule),
typeof(EShopPluginsBasketsHttpApiClientModule),
typeof(PaymentServiceHttpApiClientModule),
typeof(PaymentServiceWeChatPayHttpApiClientModule)
typeof(PaymentServiceWeChatPayHttpApiClientModule),
typeof(PaymentServicePrepaymentHttpApiClientModule)
)]
public class EShopSampleHttpApiClientModule : AbpModule
{

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

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

4
samples/EShopSample/aspnet-core/src/EShopSample.HttpApi/EShopSampleHttpApiModule.cs

@ -1,6 +1,7 @@
using EasyAbp.EShop;
using EasyAbp.EShop.Plugins.Baskets;
using EasyAbp.PaymentService;
using EasyAbp.PaymentService.Prepayment;
using EasyAbp.PaymentService.WeChatPay;
using Volo.Abp.Account;
using Volo.Abp.FeatureManagement;
@ -21,7 +22,8 @@ namespace EShopSample
typeof(EShopHttpApiModule),
typeof(EShopPluginsBasketsHttpApiModule),
typeof(PaymentServiceHttpApiModule),
typeof(PaymentServiceWeChatPayHttpApiModule)
typeof(PaymentServiceWeChatPayHttpApiModule),
typeof(PaymentServicePrepaymentHttpApiModule)
)]
public class EShopSampleHttpApiModule : AbpModule
{

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

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

16
samples/EShopSample/aspnet-core/src/EShopSample.Web/EShopSampleWebModule.cs

@ -14,12 +14,10 @@ using EasyAbp.EShop.Products.Web;
using EasyAbp.EShop.Stores;
using EasyAbp.EShop.Stores.Web;
using EasyAbp.EShop.Web;
using EasyAbp.PaymentService;
using EasyAbp.PaymentService.Prepayment.Web;
using EasyAbp.PaymentService.Web;
using EasyAbp.PaymentService.WeChatPay;
using EasyAbp.PaymentService.WeChatPay.Web;
using Localization.Resources.AbpUi;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
@ -30,28 +28,21 @@ using EShopSample.Localization;
using EShopSample.MultiTenancy;
using EShopSample.Web.Menus;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.Swagger;
using Volo.Abp;
using Volo.Abp.Account.Web;
using Volo.Abp.AspNetCore.Authentication.JwtBearer;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap;
using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.Autofac;
using Volo.Abp.AutoMapper;
using Volo.Abp.FeatureManagement;
using Volo.Abp.Identity.Web;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement.Web;
using Volo.Abp.TenantManagement.Web;
using Volo.Abp.UI.Navigation.Urls;
using Volo.Abp.UI;
using Volo.Abp.UI.Navigation;
using Volo.Abp.VirtualFileSystem;
@ -71,8 +62,9 @@ namespace EShopSample.Web
typeof(EShopWebModule),
typeof(EShopPluginsBasketsWebModule),
typeof(PaymentServiceWebModule),
typeof(PaymentServiceWeChatPayWebModule)
)]
typeof(PaymentServiceWeChatPayWebModule),
typeof(PaymentServicePrepaymentWebModule)
)]
public class EShopSampleWebModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)

Loading…
Cancel
Save