feat: support refund
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"quyun/app/models"
|
||||
"quyun/app/requests"
|
||||
"quyun/database/fields"
|
||||
@@ -30,7 +32,7 @@ func (ctl *orders) List(ctx fiber.Ctx, pagination *requests.Pagination, query *O
|
||||
}
|
||||
|
||||
// Refund
|
||||
// @Router /admin/orders/{id}/refund [post]
|
||||
// @Router /admin/orders/:id/refund [post]
|
||||
// @Bind id path
|
||||
func (ctl *orders) Refund(ctx fiber.Ctx, id int64) error {
|
||||
order, err := models.Orders.GetByID(ctx.Context(), id)
|
||||
@@ -51,7 +53,15 @@ func (ctl *orders) Refund(ctx fiber.Ctx, id int64) error {
|
||||
TransactionID(order.TransactionID).
|
||||
CNYRefundAmount(refundTotal, refundTotal).
|
||||
RefundReason("管理员退款").
|
||||
RefundGoodsInfo(post.Title)
|
||||
RefundGoods([]wepay.RefundGoodsInfo{
|
||||
{
|
||||
MerchantGoodsID: fmt.Sprintf("%d", order.PostID),
|
||||
GoodsName: post.Title,
|
||||
RefundQuantity: 1,
|
||||
RefundAmount: refundTotal,
|
||||
UnitPrice: order.Price,
|
||||
},
|
||||
})
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user