forked from gongxuegit/tiku-backend.net
feat: add tenant commerce operations
This commit is contained in:
136
Tiku.Api/Contracts/TenantCommerceDtos.cs
Normal file
136
Tiku.Api/Contracts/TenantCommerceDtos.cs
Normal file
@@ -0,0 +1,136 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json;
|
||||
using Tiku.Application.Commerce;
|
||||
using Tiku.Domain.Commerce;
|
||||
using Tiku.Domain.Common;
|
||||
using Tiku.Domain.Tenancy;
|
||||
|
||||
namespace Tiku.Api.Contracts;
|
||||
|
||||
public sealed class TenantCommerceQueryDto
|
||||
{
|
||||
[StringLength(50)]
|
||||
public string? Provider { get; set; }
|
||||
|
||||
[StringLength(32)]
|
||||
public string? Status { get; set; }
|
||||
|
||||
[Range(1, 200)]
|
||||
public int? Limit { get; set; }
|
||||
}
|
||||
|
||||
public sealed class UpsertPaymentAccountDto
|
||||
{
|
||||
[Required]
|
||||
[StringLength(50)]
|
||||
public string Provider { get; set; } = string.Empty;
|
||||
|
||||
public TenantPaymentMode Mode { get; set; } = TenantPaymentMode.TenantCollect;
|
||||
|
||||
[StringLength(200)]
|
||||
public string? DisplayName { get; set; }
|
||||
|
||||
public TenantPaymentAccountStatus Status { get; set; } = TenantPaymentAccountStatus.Disabled;
|
||||
|
||||
public JsonElement ConfigPublic { get; set; } = JsonDefaults.Object();
|
||||
|
||||
public UpsertPaymentAccountCommand ToCommand()
|
||||
{
|
||||
return new UpsertPaymentAccountCommand(Provider, Mode, DisplayName, Status, ConfigPublic);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class UpsertTenantSecretDto
|
||||
{
|
||||
[Required]
|
||||
[StringLength(80)]
|
||||
public string Purpose { get; set; } = "payment";
|
||||
|
||||
[Required]
|
||||
[StringLength(50)]
|
||||
public string Provider { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(120)]
|
||||
public string SecretKey { get; set; } = string.Empty;
|
||||
|
||||
[StringLength(300)]
|
||||
public string SecretRef { get; set; } = string.Empty;
|
||||
|
||||
public TenantSecretStatus Status { get; set; } = TenantSecretStatus.Active;
|
||||
public JsonElement SecretPayload { get; set; } = JsonDefaults.Object();
|
||||
public DateTimeOffset? ExpiresAt { get; set; }
|
||||
|
||||
public UpsertTenantSecretCommand ToCommand()
|
||||
{
|
||||
return new UpsertTenantSecretCommand(
|
||||
Purpose,
|
||||
Provider,
|
||||
SecretKey,
|
||||
SecretRef,
|
||||
Status,
|
||||
SecretPayload,
|
||||
ExpiresAt);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class CreateCodeBatchDto
|
||||
{
|
||||
[Required]
|
||||
[StringLength(200)]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[Range(1, 1000)]
|
||||
public int TotalCount { get; set; }
|
||||
|
||||
[Range(1, 3650)]
|
||||
public int Days { get; set; }
|
||||
|
||||
public Guid? RegionId { get; set; }
|
||||
|
||||
[StringLength(50)]
|
||||
public string? SaleType { get; set; }
|
||||
|
||||
[StringLength(100)]
|
||||
public string? Channel { get; set; }
|
||||
|
||||
[Range(0, int.MaxValue)]
|
||||
public int? DefaultUnitPriceCents { get; set; }
|
||||
|
||||
[Range(0, int.MaxValue)]
|
||||
public int? CostPriceCents { get; set; }
|
||||
|
||||
[StringLength(1000)]
|
||||
public string? Remark { get; set; }
|
||||
|
||||
public CreateCodeBatchCommand ToCommand()
|
||||
{
|
||||
return new CreateCodeBatchCommand(
|
||||
Name,
|
||||
TotalCount,
|
||||
Days,
|
||||
RegionId,
|
||||
SaleType,
|
||||
Channel,
|
||||
DefaultUnitPriceCents,
|
||||
CostPriceCents,
|
||||
Remark);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class RedeemActivationCodeDto
|
||||
{
|
||||
[Required]
|
||||
[StringLength(100)]
|
||||
public string Code { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public Guid UserId { get; set; }
|
||||
|
||||
public Guid? RegionId { get; set; }
|
||||
|
||||
public RedeemActivationCodeCommand ToCommand()
|
||||
{
|
||||
return new RedeemActivationCodeCommand(Code, UserId, RegionId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user