Browse Source
Merge pull request #269 from EasyAbp/refund-appservice-payment-id
Add `GetRefundListDto.PaymentId`
pull/270/head
5.0.0-preview.2
Super
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
22 additions and
5 deletions
-
common.props
-
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp/EShop/Payments/Refunds/Dtos/GetRefundListDto.cs
-
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/RefundAppService.cs
|
|
|
@ -1,7 +1,7 @@ |
|
|
|
<Project> |
|
|
|
<PropertyGroup> |
|
|
|
<LangVersion>latest</LangVersion> |
|
|
|
<Version>5.0.0-preview.1</Version> |
|
|
|
<Version>5.0.0-preview.2</Version> |
|
|
|
<NoWarn>$(NoWarn);CS1591</NoWarn> |
|
|
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> |
|
|
|
<Authors>EasyAbp Team</Authors> |
|
|
|
|
|
|
|
@ -7,5 +7,7 @@ namespace EasyAbp.EShop.Payments.Refunds.Dtos |
|
|
|
public class GetRefundListDto : PagedAndSortedResultRequestDto |
|
|
|
{ |
|
|
|
public Guid? UserId { get; set; } |
|
|
|
|
|
|
|
public Guid? PaymentId { get; set; } |
|
|
|
} |
|
|
|
} |
|
|
|
@ -62,16 +62,31 @@ namespace EasyAbp.EShop.Payments.Refunds |
|
|
|
|
|
|
|
protected override async Task<IQueryable<Refund>> CreateFilteredQueryAsync(GetRefundListDto input) |
|
|
|
{ |
|
|
|
return input.UserId.HasValue |
|
|
|
? await _repository.GetQueryableByUserIdAsync(input.UserId.Value) |
|
|
|
: await _repository.GetQueryableAsync(); |
|
|
|
return (input.UserId.HasValue |
|
|
|
? await _repository.GetQueryableByUserIdAsync(input.UserId.Value) |
|
|
|
: await _repository.GetQueryableAsync()) |
|
|
|
.WhereIf(input.PaymentId.HasValue, x => x.PaymentId == input.PaymentId.Value); |
|
|
|
} |
|
|
|
|
|
|
|
// Todo: should a store owner user see orders of other stores in the same payment/refund?
|
|
|
|
[Authorize] |
|
|
|
public override async Task<PagedResultDto<RefundDto>> GetListAsync(GetRefundListDto input) |
|
|
|
{ |
|
|
|
if (input.UserId != CurrentUser.GetId()) |
|
|
|
if (input.UserId.HasValue) |
|
|
|
{ |
|
|
|
if (input.UserId.Value != CurrentUser.GetId()) |
|
|
|
{ |
|
|
|
await CheckPolicyAsync(GetListPolicyName); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (input.PaymentId.HasValue) |
|
|
|
{ |
|
|
|
if ((await _paymentRepository.FindAsync(input.PaymentId.Value))?.UserId != CurrentUser.GetId()) |
|
|
|
{ |
|
|
|
await CheckPolicyAsync(GetListPolicyName); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
await CheckPolicyAsync(GetListPolicyName); |
|
|
|
} |
|
|
|
|