Browse Source

fix error code

pull/116/head 2.1.1
Huei Feng 6 years ago
parent
commit
f7bc19be7e
  1. 28
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/PaymentAppService.cs
  2. 18
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/RefundAppService.cs
  3. 27
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Web/Properties/launchSettings.json

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

@ -26,7 +26,7 @@ namespace EasyAbp.EShop.Payments.Payments
private readonly IDistributedEventBus _distributedEventBus;
private readonly IOrderAppService _orderAppService;
private readonly IPaymentRepository _repository;
public PaymentAppService(
IDistributedEventBus distributedEventBus,
IOrderAppService orderAppService,
@ -49,7 +49,7 @@ namespace EasyAbp.EShop.Payments.Payments
return payment;
}
protected override IQueryable<Payment> CreateFilteredQuery(GetPaymentListDto input)
{
var query = base.CreateFilteredQuery(input);
@ -73,19 +73,19 @@ namespace EasyAbp.EShop.Payments.Payments
return await base.GetListAsync(input);
}
[Authorize(PaymentsPermissions.Payments.Create)]
public virtual async Task CreateAsync(CreatePaymentDto input)
{
// Todo: should avoid duplicate creations. (concurrent lock)
var orders = new List<OrderDto>();
foreach (var orderId in input.OrderIds)
{
orders.Add(await _orderAppService.GetAsync(orderId));
}
await AuthorizationService.CheckAsync(
new PaymentCreationResource
{
@ -95,20 +95,18 @@ namespace EasyAbp.EShop.Payments.Payments
new PaymentOperationAuthorizationRequirement(PaymentOperation.Creation)
);
var createPaymentEto = new CreatePaymentEto
{
TenantId = CurrentTenant.Id,
UserId = CurrentUser.GetId(),
PaymentMethod = input.PaymentMethod,
Currency = orders.First().Currency,
ExtraProperties = new ExtraPropertyDictionary(),
PaymentItems = orders.Select(order => new CreatePaymentItemEto
var createPaymentEto = new CreatePaymentEto(
tenantId: CurrentTenant.Id,
userId: CurrentUser.GetId(), paymentMethod: input.PaymentMethod, currency: orders.First().Currency,
paymentItems: orders.Select(order => new CreatePaymentItemEto
{
ItemType = PaymentsConsts.PaymentItemType,
ItemKey = order.Id.ToString(),
OriginalPaymentAmount = order.ActualTotalPrice,
ExtraProperties = new ExtraPropertyDictionary {{"StoreId", order.StoreId.ToString()}}
}).ToList()
ExtraProperties = new ExtraPropertyDictionary { { "StoreId", order.StoreId.ToString() } }
}).ToList())
{
ExtraProperties = new ExtraPropertyDictionary()
};
await _distributedEventBus.PublishAsync(createPaymentEto);

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

@ -31,7 +31,7 @@ namespace EasyAbp.EShop.Payments.Refunds
private readonly IPaymentRepository _paymentRepository;
private readonly IJsonSerializer _jsonSerializer;
private readonly IRefundRepository _repository;
public RefundAppService(
IOrderAppService orderAppService,
IDistributedEventBus distributedEventBus,
@ -52,7 +52,7 @@ namespace EasyAbp.EShop.Payments.Refunds
var refund = await base.GetAsync(id);
var payment = await _paymentRepository.GetAsync(refund.PaymentId);
if (payment.UserId != CurrentUser.GetId())
{
await CheckPolicyAsync(GetPolicyName);
@ -60,7 +60,7 @@ namespace EasyAbp.EShop.Payments.Refunds
return refund;
}
protected override IQueryable<Refund> CreateFilteredQuery(GetRefundListDto input)
{
var query = input.UserId.HasValue ? _repository.GetQueryableByUserId(input.UserId.Value) : _repository;
@ -85,7 +85,7 @@ namespace EasyAbp.EShop.Payments.Refunds
await AuthorizationService.CheckAsync(PaymentsPermissions.Refunds.Manage);
var payment = await _paymentRepository.GetAsync(input.PaymentId);
var createRefundInput = new CreateRefundInput
{
PaymentId = input.PaymentId,
@ -93,7 +93,7 @@ namespace EasyAbp.EShop.Payments.Refunds
CustomerRemark = input.CustomerRemark,
StaffRemark = input.StaffRemark
};
foreach (var refundItem in input.RefundItems)
{
var order = await _orderAppService.GetAsync(refundItem.OrderId);
@ -110,7 +110,7 @@ namespace EasyAbp.EShop.Payments.Refunds
foreach (var orderLineRefundInfoModel in refundItem.OrderLines)
{
var orderLine = order.OrderLines.Single(x => x.Id == orderLineRefundInfoModel.OrderLineId);
if (orderLine.RefundedQuantity + orderLineRefundInfoModel.Quantity > orderLine.Quantity)
{
throw new InvalidRefundQuantityException(orderLineRefundInfoModel.Quantity);
@ -132,11 +132,7 @@ namespace EasyAbp.EShop.Payments.Refunds
});
}
await _distributedEventBus.PublishAsync(new RefundPaymentEto
{
TenantId = CurrentTenant.Id,
CreateRefundInput = createRefundInput
});
await _distributedEventBus.PublishAsync(new RefundPaymentEto(tenantId: CurrentTenant.Id, createRefundInput));
}
}
}

27
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Web/Properties/launchSettings.json

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:54581/",
"sslPort": 44336
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"EasyAbp.EShop.Plugins.Coupons.Web": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
}
}
}
Loading…
Cancel
Save