feat: add coupon checkout support

This commit is contained in:
xiong
2026-07-26 20:04:24 +08:00
parent a4621df728
commit 7139da766a
6 changed files with 673 additions and 9 deletions

View File

@@ -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);
}
}