feat: complete phase six backoffice operations

This commit is contained in:
2026-07-28 14:31:43 +08:00
parent 747ff59d76
commit 99e4e43122
31 changed files with 23504 additions and 26 deletions

View File

@@ -7,6 +7,7 @@ using Tiku.Api.Contracts;
using Tiku.Application.Commerce;
using Tiku.Application.Security;
using Tiku.Application.Tenancy;
using Tiku.Domain.Commerce;
namespace Tiku.Api.Controllers;
@@ -16,6 +17,7 @@ namespace Tiku.Api.Controllers;
[Route("api/commerce")]
public sealed class CommerceController(
ICommerceService commerceService,
ICommerceAdminService commerceAdminService,
ICurrentUser currentUser,
ITenantContext currentTenant,
ITenantContextInitializer tenantInitializer,
@@ -151,6 +153,36 @@ public sealed class CommerceController(
cancellationToken));
}
[AllowAnonymous]
[HttpPost("refunds/notify/wechat_pay")]
[EndpointSummary("微信退款结果回调")]
[ProducesResponseType<CommerceRefundRequest>(StatusCodes.Status200OK)]
public async Task<ActionResult<CommerceRefundRequest>> WechatRefundNotify(
[FromQuery] string? tenantCode,
RefundNotificationDto request,
CancellationToken cancellationToken)
{
return Ok(await commerceAdminService.ProcessRefundNotificationAsync(
await ResolveNotificationTenantAsync(tenantCode, cancellationToken),
request.ToCommand(PaymentProviders.WechatPay),
cancellationToken));
}
[AllowAnonymous]
[HttpPost("refunds/notify/alipay")]
[EndpointSummary("支付宝退款结果回调")]
[ProducesResponseType<CommerceRefundRequest>(StatusCodes.Status200OK)]
public async Task<ActionResult<CommerceRefundRequest>> AlipayRefundNotify(
[FromQuery] string? tenantCode,
RefundNotificationDto request,
CancellationToken cancellationToken)
{
return Ok(await commerceAdminService.ProcessRefundNotificationAsync(
await ResolveNotificationTenantAsync(tenantCode, cancellationToken),
request.ToCommand(PaymentProviders.Alipay),
cancellationToken));
}
private async Task<Guid> ResolveNotificationTenantAsync(
string? tenantCode,
CancellationToken cancellationToken)