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

@@ -1,4 +1,5 @@
using System.Text.Json;
using Tiku.Application.Jobs;
using Tiku.Domain.Commerce;
using Tiku.Domain.Tenancy;
@@ -180,6 +181,81 @@ public sealed record CreateReconciliationBatchCommand(
public sealed record TenantReconciliationBatchList(IReadOnlyCollection<CommerceReconciliationBatch> Items);
public sealed record TenantReconciliationIssueList(IReadOnlyCollection<CommerceReconciliationIssue> Items);
public sealed record TenantReconciliationItemList(IReadOnlyCollection<CommerceReconciliationItem> Items);
public sealed record TenantReconciliationIssueEventList(IReadOnlyCollection<CommerceReconciliationIssueEvent> Items);
public sealed record TenantCommerceAnomalySummary(
int OpenRefundCount,
int ProcessingRefundCount,
int OpenReconciliationIssueCount,
int FailedReconciliationBatchCount,
int PendingPaymentCount,
int PaymentMismatchCount);
public sealed record CreateAdjustmentVoucherCommand(
Guid? IssueId,
Guid? BatchId,
Guid? ItemId,
Guid? OrderId,
Guid? PaymentId,
Guid? RefundRequestId,
CommerceAdjustmentDirection Direction,
int AmountCents,
string? Currency,
string Reason,
string? ProofAssetKey,
JsonElement Metadata);
public sealed record UpdateAdjustmentVoucherStatusCommand(
Guid VoucherId,
CommerceAdjustmentVoucherStatus Status,
string? Note);
public sealed record TenantAdjustmentVoucherList(IReadOnlyCollection<CommerceAdjustmentVoucher> Items);
public sealed record TenantAdjustmentVoucherEventList(IReadOnlyCollection<CommerceAdjustmentVoucherEvent> Items);
public sealed record TenantAdjustmentReport(
int DraftCount,
int PendingReviewCount,
int ApprovedCount,
int ClosedCount,
int IncreaseRevenueCents,
int DecreaseRevenueCents);
public sealed record PreviewReconciliationImportCommand(
string Provider,
DateOnly BillDate,
ReconciliationBillType BillType,
string SourceName,
JsonElement Rows);
public sealed record ReconciliationImportPreview(
int TotalCount,
int PaymentCount,
int RefundCount,
int InvalidCount,
int AmountCents,
int RefundAmountCents,
string SourceHash);
public sealed record ImportReconciliationCommand(
string Provider,
DateOnly BillDate,
ReconciliationBillType BillType,
string SourceName,
JsonElement Rows);
public sealed record RequestProviderBillJobCommand(
string Provider,
DateOnly BillDate,
ReconciliationBillType BillType,
DateTimeOffset? RunAfter = null);
public sealed record RefundNotificationCommand(
string Provider,
string RefundNo,
string? ProviderRefundNo,
CommerceRefundStatus Status,
string? EventId,
JsonElement Payload);
public sealed record UpdateReconciliationIssueCommand(
Guid IssueId,
@@ -324,4 +400,72 @@ public interface ICommerceAdminService
CommerceAdminActor actor,
UpdateReconciliationIssueCommand command,
CancellationToken cancellationToken = default);
Task<TenantReconciliationItemList> GetReconciliationItemsAsync(
CommerceAdminActor actor,
Guid batchId,
CancellationToken cancellationToken = default);
Task<TenantReconciliationIssueEventList> GetReconciliationIssueEventsAsync(
CommerceAdminActor actor,
Guid issueId,
CancellationToken cancellationToken = default);
Task<TenantCommerceAnomalySummary> GetAnomalySummaryAsync(
CommerceAdminActor actor,
CancellationToken cancellationToken = default);
Task<TenantAdjustmentVoucherList> GetAdjustmentVouchersAsync(
CommerceAdminActor actor,
CommerceAdminQuery query,
CancellationToken cancellationToken = default);
Task<CommerceAdjustmentVoucher> GetAdjustmentVoucherAsync(
CommerceAdminActor actor,
Guid voucherId,
CancellationToken cancellationToken = default);
Task<CommerceAdjustmentVoucher> CreateAdjustmentVoucherAsync(
CommerceAdminActor actor,
CreateAdjustmentVoucherCommand command,
CancellationToken cancellationToken = default);
Task<CommerceAdjustmentVoucher> UpdateAdjustmentVoucherStatusAsync(
CommerceAdminActor actor,
UpdateAdjustmentVoucherStatusCommand command,
CancellationToken cancellationToken = default);
Task<TenantAdjustmentVoucherEventList> GetAdjustmentVoucherEventsAsync(
CommerceAdminActor actor,
Guid voucherId,
CancellationToken cancellationToken = default);
Task<TenantAdjustmentReport> GetAdjustmentReportAsync(
CommerceAdminActor actor,
CancellationToken cancellationToken = default);
Task<ReconciliationImportPreview> PreviewReconciliationImportAsync(
CommerceAdminActor actor,
PreviewReconciliationImportCommand command,
CancellationToken cancellationToken = default);
Task<CommerceReconciliationBatch> ImportReconciliationAsync(
CommerceAdminActor actor,
ImportReconciliationCommand command,
CancellationToken cancellationToken = default);
Task<BackgroundJobItem> RequestProviderBillJobAsync(
CommerceAdminActor actor,
RequestProviderBillJobCommand command,
CancellationToken cancellationToken = default);
Task<IReadOnlyCollection<BackgroundJobItem>> GetProviderBillJobsAsync(
CommerceAdminActor actor,
CommerceAdminQuery query,
CancellationToken cancellationToken = default);
Task<CommerceRefundRequest> ProcessRefundNotificationAsync(
Guid tenantId,
RefundNotificationCommand command,
CancellationToken cancellationToken = default);
}