forked from gongxuegit/tiku-backend.net
feat: add tenant commerce operations
This commit is contained in:
135
Tiku.Application/Commerce/CommerceAdminModels.cs
Normal file
135
Tiku.Application/Commerce/CommerceAdminModels.cs
Normal file
@@ -0,0 +1,135 @@
|
||||
using System.Text.Json;
|
||||
using Tiku.Domain.Commerce;
|
||||
using Tiku.Domain.Tenancy;
|
||||
|
||||
namespace Tiku.Application.Commerce;
|
||||
|
||||
public sealed record CommerceAdminActor(Guid TenantId, Guid UserId);
|
||||
|
||||
public sealed record CommerceAdminQuery(string? Provider = null, string? Status = null, int? Limit = null);
|
||||
|
||||
public sealed record UpsertPaymentAccountCommand(
|
||||
string Provider,
|
||||
TenantPaymentMode Mode,
|
||||
string? DisplayName,
|
||||
TenantPaymentAccountStatus Status,
|
||||
JsonElement ConfigPublic);
|
||||
|
||||
public sealed record TenantPaymentAccountItem(
|
||||
Guid Id,
|
||||
string Provider,
|
||||
string Mode,
|
||||
string? DisplayName,
|
||||
string Status,
|
||||
JsonElement ConfigPublic,
|
||||
DateTimeOffset CreatedAt,
|
||||
DateTimeOffset UpdatedAt);
|
||||
|
||||
public sealed record UpsertTenantSecretCommand(
|
||||
string Purpose,
|
||||
string Provider,
|
||||
string SecretKey,
|
||||
string SecretRef,
|
||||
TenantSecretStatus Status,
|
||||
JsonElement SecretPayload,
|
||||
DateTimeOffset? ExpiresAt);
|
||||
|
||||
public sealed record TenantSecretItem(
|
||||
Guid Id,
|
||||
string Purpose,
|
||||
string Provider,
|
||||
string SecretKey,
|
||||
string SecretRef,
|
||||
string Status,
|
||||
DateTimeOffset? RotatedAt,
|
||||
DateTimeOffset? ExpiresAt,
|
||||
DateTimeOffset UpdatedAt);
|
||||
|
||||
public sealed record AdminOrderList(IReadOnlyCollection<CommerceOrderItem> Items);
|
||||
|
||||
public sealed record AdminPaymentList(IReadOnlyCollection<CommercePaymentItem> Items);
|
||||
|
||||
public sealed record CreateCodeBatchCommand(
|
||||
string Name,
|
||||
int TotalCount,
|
||||
int Days,
|
||||
Guid? RegionId,
|
||||
string? SaleType,
|
||||
string? Channel,
|
||||
int? DefaultUnitPriceCents,
|
||||
int? CostPriceCents,
|
||||
string? Remark);
|
||||
|
||||
public sealed record CodeBatchItem(
|
||||
Guid Id,
|
||||
string Name,
|
||||
int TotalCount,
|
||||
int Days,
|
||||
Guid? RegionId,
|
||||
string? SaleType,
|
||||
string? Channel,
|
||||
int DefaultUnitPriceCents,
|
||||
int CostPriceCents,
|
||||
DateTimeOffset? IssuedAt,
|
||||
string? Remark,
|
||||
DateTimeOffset CreatedAt);
|
||||
|
||||
public sealed record ActivationCodeItem(
|
||||
Guid Id,
|
||||
Guid? BatchId,
|
||||
string Code,
|
||||
int Days,
|
||||
bool IsUsed,
|
||||
Guid? UsedBy,
|
||||
DateTimeOffset? UsedAt,
|
||||
string? SaleType,
|
||||
string? SoldTo,
|
||||
string? Remark,
|
||||
DateTimeOffset CreatedAt);
|
||||
|
||||
public sealed record ActivationCodeList(IReadOnlyCollection<ActivationCodeItem> Items);
|
||||
|
||||
public sealed record RedeemActivationCodeCommand(string Code, Guid UserId, Guid? RegionId);
|
||||
|
||||
public interface ICommerceAdminService
|
||||
{
|
||||
Task<IReadOnlyCollection<TenantPaymentAccountItem>> GetPaymentAccountsAsync(
|
||||
CommerceAdminActor actor,
|
||||
CommerceAdminQuery query,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<TenantPaymentAccountItem> UpsertPaymentAccountAsync(
|
||||
CommerceAdminActor actor,
|
||||
UpsertPaymentAccountCommand command,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<TenantSecretItem> UpsertTenantSecretAsync(
|
||||
CommerceAdminActor actor,
|
||||
UpsertTenantSecretCommand command,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<AdminOrderList> GetOrdersAsync(
|
||||
CommerceAdminActor actor,
|
||||
CommerceAdminQuery query,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<AdminPaymentList> GetPaymentsAsync(
|
||||
CommerceAdminActor actor,
|
||||
CommerceAdminQuery query,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<CodeBatchItem> CreateCodeBatchAsync(
|
||||
CommerceAdminActor actor,
|
||||
CreateCodeBatchCommand command,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<ActivationCodeList> GetActivationCodesAsync(
|
||||
CommerceAdminActor actor,
|
||||
CommerceAdminQuery query,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<ActivationCodeItem> RedeemActivationCodeAsync(
|
||||
CommerceAdminActor actor,
|
||||
RedeemActivationCodeCommand command,
|
||||
CancellationToken cancellationToken = default);
|
||||
}
|
||||
Reference in New Issue
Block a user