forked from gongxuegit/tiku-backend.net
feat: add coupon checkout support
This commit is contained in:
@@ -22,6 +22,8 @@ public sealed class CreateCommerceOrderDto
|
||||
[StringLength(100)]
|
||||
public string? CouponCode { get; set; }
|
||||
|
||||
public Guid? CouponRedemptionId { get; set; }
|
||||
|
||||
public CreateCommerceOrderCommand ToCommand()
|
||||
{
|
||||
return new CreateCommerceOrderCommand(
|
||||
@@ -30,7 +32,8 @@ public sealed class CreateCommerceOrderDto
|
||||
PayMethod,
|
||||
PayProvider,
|
||||
RegionId,
|
||||
CouponCode);
|
||||
CouponCode,
|
||||
CouponRedemptionId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,3 +80,50 @@ public sealed class CreateCommercePaymentDto
|
||||
QuitUrl);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class CommerceCouponQueryDto
|
||||
{
|
||||
[Range(1, 100)]
|
||||
public int? Limit { get; set; }
|
||||
|
||||
[StringLength(32)]
|
||||
public string? Status { get; set; }
|
||||
|
||||
public CommerceCouponQuery ToQuery()
|
||||
{
|
||||
return new CommerceCouponQuery(Limit, Status);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ClaimCommerceCouponDto
|
||||
{
|
||||
[Required]
|
||||
[StringLength(100)]
|
||||
public string CouponCode { get; set; } = string.Empty;
|
||||
|
||||
public ClaimCommerceCouponCommand ToCommand()
|
||||
{
|
||||
return new ClaimCommerceCouponCommand(CouponCode);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class CheckCommerceCouponDto
|
||||
{
|
||||
[StringLength(100)]
|
||||
public string? CouponCode { get; set; }
|
||||
|
||||
public Guid? CouponRedemptionId { get; set; }
|
||||
|
||||
[Required]
|
||||
public Guid PlanId { get; set; }
|
||||
|
||||
[Range(1, 99)]
|
||||
public int Quantity { get; set; } = 1;
|
||||
|
||||
public Guid? RegionId { get; set; }
|
||||
|
||||
public CheckCommerceCouponCommand ToCommand()
|
||||
{
|
||||
return new CheckCommerceCouponCommand(CouponCode, CouponRedemptionId, PlanId, Quantity, RegionId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user