forked from gongxuegit/tiku-backend.net
feat: add commerce order and payment checkout
This commit is contained in:
79
Tiku.Api/Contracts/CommerceDtos.cs
Normal file
79
Tiku.Api/Contracts/CommerceDtos.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Tiku.Application.Commerce;
|
||||
|
||||
namespace Tiku.Api.Contracts;
|
||||
|
||||
public sealed class CreateCommerceOrderDto
|
||||
{
|
||||
[Required]
|
||||
public Guid PlanId { get; set; }
|
||||
|
||||
[Range(1, 99)]
|
||||
public int Quantity { get; set; } = 1;
|
||||
|
||||
[StringLength(50)]
|
||||
public string? PayMethod { get; set; }
|
||||
|
||||
[StringLength(50)]
|
||||
public string? PayProvider { get; set; }
|
||||
|
||||
public Guid? RegionId { get; set; }
|
||||
|
||||
[StringLength(100)]
|
||||
public string? CouponCode { get; set; }
|
||||
|
||||
public CreateCommerceOrderCommand ToCommand()
|
||||
{
|
||||
return new CreateCommerceOrderCommand(
|
||||
PlanId,
|
||||
Quantity,
|
||||
PayMethod,
|
||||
PayProvider,
|
||||
RegionId,
|
||||
CouponCode);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class CommerceOrderQueryDto
|
||||
{
|
||||
[Range(1, 100)]
|
||||
public int? Limit { get; set; }
|
||||
|
||||
[StringLength(32)]
|
||||
public string? Status { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CreateCommercePaymentDto
|
||||
{
|
||||
[Required]
|
||||
[StringLength(100)]
|
||||
public string OrderNo { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(50)]
|
||||
public string Provider { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(50)]
|
||||
public string Method { get; set; } = string.Empty;
|
||||
|
||||
[StringLength(255)]
|
||||
public string? OpenId { get; set; }
|
||||
|
||||
[StringLength(2048)]
|
||||
public string? ReturnUrl { get; set; }
|
||||
|
||||
[StringLength(2048)]
|
||||
public string? QuitUrl { get; set; }
|
||||
|
||||
public CreateCommercePaymentCommand ToCommand()
|
||||
{
|
||||
return new CreateCommercePaymentCommand(
|
||||
OrderNo,
|
||||
Provider,
|
||||
Method,
|
||||
OpenId,
|
||||
ReturnUrl,
|
||||
QuitUrl);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user