新增分比退款
This commit is contained in:
parent
478ac7a5a3
commit
35d63981ed
@ -36,7 +36,8 @@ type GetOrderInquiryPage struct {
|
|||||||
|
|
||||||
// CancelOrderInquiry 取消问诊订单
|
// CancelOrderInquiry 取消问诊订单
|
||||||
type CancelOrderInquiry struct {
|
type CancelOrderInquiry struct {
|
||||||
CancelRemarks string `json:"cancel_remarks" form:"cancel_remarks" validate:"required" label:"取消订单备注"`
|
RefundAmount float64 `json:"refund_amount" form:"refund_amount" validate:"required" label:"退款金额"`
|
||||||
|
CancelRemarks string `json:"cancel_remarks" form:"cancel_remarks" validate:"required" label:"取消订单备注"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetOrderInquiryRecordPage 获取问诊记录列表-分页
|
// GetOrderInquiryRecordPage 获取问诊记录列表-分页
|
||||||
|
|||||||
@ -70,6 +70,11 @@ func (r *OrderInquiryService) CancelOrderInquiry(req requests.CancelOrderInquiry
|
|||||||
return false, errors.New("订单未支付,无需取消")
|
return false, errors.New("订单未支付,无需取消")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检测退款金额
|
||||||
|
if req.RefundAmount > orderInquiry.PaymentAmountTotal {
|
||||||
|
return false, errors.New("退款金额不可超过实付金额")
|
||||||
|
}
|
||||||
|
|
||||||
// 订单完成时间预留5分钟进行操作
|
// 订单完成时间预留5分钟进行操作
|
||||||
if !orderInquiry.CompleteTime.IsEmpty() {
|
if !orderInquiry.CompleteTime.IsEmpty() {
|
||||||
// 计算三天后的时间
|
// 计算三天后的时间
|
||||||
@ -113,6 +118,7 @@ func (r *OrderInquiryService) CancelOrderInquiry(req requests.CancelOrderInquiry
|
|||||||
OutTradeNo: orderInquiry.InquiryNo,
|
OutTradeNo: orderInquiry.InquiryNo,
|
||||||
OutRefundNo: inquiryRefundNo,
|
OutRefundNo: inquiryRefundNo,
|
||||||
Reason: "客服取消",
|
Reason: "客服取消",
|
||||||
|
RefundAmount: int64(req.RefundAmount * 100),
|
||||||
PaymentAmountTotal: int64(orderInquiry.PaymentAmountTotal * 100),
|
PaymentAmountTotal: int64(orderInquiry.PaymentAmountTotal * 100),
|
||||||
NotifyUrl: config.C.Wechat.RefundNotifyDomain + config.C.Wechat.PatientInquiryRefundNotifyUrl,
|
NotifyUrl: config.C.Wechat.RefundNotifyDomain + config.C.Wechat.PatientInquiryRefundNotifyUrl,
|
||||||
}
|
}
|
||||||
@ -196,7 +202,7 @@ func (r *OrderInquiryService) CancelOrderInquiry(req requests.CancelOrderInquiry
|
|||||||
InquiryRefundNo: inquiryRefundNo,
|
InquiryRefundNo: inquiryRefundNo,
|
||||||
RefundId: refundId,
|
RefundId: refundId,
|
||||||
InquiryRefundStatus: inquiryRefundStatus,
|
InquiryRefundStatus: inquiryRefundStatus,
|
||||||
RefundTotal: orderInquiry.PaymentAmountTotal,
|
RefundTotal: req.RefundAmount,
|
||||||
RefundReason: req.CancelRemarks,
|
RefundReason: req.CancelRemarks,
|
||||||
SuccessTime: model.LocalTime(successTime),
|
SuccessTime: model.LocalTime(successTime),
|
||||||
}
|
}
|
||||||
|
|||||||
@ -167,6 +167,7 @@ func (r *OrderProductService) CancelOrderProduct(req requests.CancelOrderProduct
|
|||||||
OutTradeNo: orderProduct.OrderProductNo,
|
OutTradeNo: orderProduct.OrderProductNo,
|
||||||
OutRefundNo: refundNo,
|
OutRefundNo: refundNo,
|
||||||
Reason: "客服取消",
|
Reason: "客服取消",
|
||||||
|
RefundAmount: int64(orderProduct.PaymentAmountTotal * 100),
|
||||||
PaymentAmountTotal: int64(orderProduct.PaymentAmountTotal * 100),
|
PaymentAmountTotal: int64(orderProduct.PaymentAmountTotal * 100),
|
||||||
NotifyUrl: config.C.Wechat.RefundNotifyDomain + config.C.Wechat.PatientProductRefundNotifyUrl,
|
NotifyUrl: config.C.Wechat.RefundNotifyDomain + config.C.Wechat.PatientProductRefundNotifyUrl,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,8 @@ type RefundRequest struct {
|
|||||||
OutTradeNo string `json:"out_trade_no" comment:"商户订单号"`
|
OutTradeNo string `json:"out_trade_no" comment:"商户订单号"`
|
||||||
OutRefundNo string `json:"out_refund_no" comment:"退款订单号"`
|
OutRefundNo string `json:"out_refund_no" comment:"退款订单号"`
|
||||||
Reason string `json:"reason" comment:"退款原因"`
|
Reason string `json:"reason" comment:"退款原因"`
|
||||||
PaymentAmountTotal int64 `json:"payment_amount_total" comment:"退款金额"`
|
RefundAmount int64 `json:"refund_amount" comment:"退款金额"`
|
||||||
|
PaymentAmountTotal int64 `json:"payment_amount_total" comment:"支付金额"`
|
||||||
NotifyUrl string `json:"notify_url" comment:"回调地址"`
|
NotifyUrl string `json:"notify_url" comment:"回调地址"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +73,7 @@ func (r RefundRequest) Refund(orderType int) (*refunddomestic.Refund, error) {
|
|||||||
NotifyUrl: core.String(r.NotifyUrl),
|
NotifyUrl: core.String(r.NotifyUrl),
|
||||||
Amount: &refunddomestic.AmountReq{
|
Amount: &refunddomestic.AmountReq{
|
||||||
Currency: core.String("CNY"),
|
Currency: core.String("CNY"),
|
||||||
Refund: core.Int64(r.PaymentAmountTotal),
|
Refund: core.Int64(r.RefundAmount),
|
||||||
Total: core.Int64(r.PaymentAmountTotal),
|
Total: core.Int64(r.PaymentAmountTotal),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user