feat: 添加订单退款功能的测试用例及相关逻辑

This commit is contained in:
2025-12-23 09:26:22 +08:00
parent ead821ac2c
commit dd7bcdfb98
3 changed files with 104 additions and 43 deletions

View File

@@ -135,23 +135,25 @@ func (*orderAdmin) adminOrderDetail(
return &dto.AdminOrderDetail{Order: m}, nil
}
// adminRefund
//
// @Summary 订单退款(租户管理)
// @Tags Tenant
// @Accept json
// @Produce json
// @Param tenantCode path string true "Tenant Code"
// @Param orderID path int64 true "OrderID"
// @Param form body dto.AdminOrderRefundForm true "Form"
// @Success 200 {object} models.Order
//
// @Router /t/:tenantCode/v1/admin/orders/:orderID/refund [post]
// @Bind tenant local key(tenant)
// @Bind tenantUser local key(tenant_user)
// @Bind orderID path
// @Bind form body
func (*orderAdmin) adminRefund(
// adminRefund
//
// @Summary 订单退款(租户管理)
// @Description 该接口只负责将订单从 paid 推进到 refunding并提交异步退款任务退款入账与权益回收由 worker 异步完成。
// @Description 重复请求幂等:订单处于 refunding/refunded 时会返回当前订单状态,不会重复入账/重复回收权益。
// @Tags Tenant
// @Accept json
// @Produce json
// @Param tenantCode path string true "Tenant Code"
// @Param orderID path int64 true "OrderID"
// @Param form body dto.AdminOrderRefundForm true "Form"
// @Success 200 {object} models.Order
//
// @Router /t/:tenantCode/v1/admin/orders/:orderID/refund [post]
// @Bind tenant local key(tenant)
// @Bind tenantUser local key(tenant_user)
// @Bind orderID path
// @Bind form body
func (*orderAdmin) adminRefund(
ctx fiber.Ctx,
tenant *models.Tenant,
tenantUser *models.TenantUser,