新增接口
This commit is contained in:
@@ -238,6 +238,27 @@ func (s *Service) List(ctx context.Context, req *dto.RefundListRequest) (*dto.Re
|
||||
}
|
||||
|
||||
// GetByID 根据 ID 查询退款申请详情
|
||||
// TriggerApproval 为历史退款申请主动补发企业微信审批。
|
||||
func (s *Service) TriggerApproval(ctx context.Context, id uint) (*dto.RefundResponse, error) {
|
||||
if s.refundApprovalCreation == nil {
|
||||
return nil, errors.New(errors.CodeServiceUnavailable, "退款审批能力未配置")
|
||||
}
|
||||
refund, err := s.refundStore.GetByIDForOperation(ctx, id)
|
||||
if err != nil {
|
||||
return nil, errors.New(errors.CodeNotFound, "退款申请不存在")
|
||||
}
|
||||
result, err := s.refundApprovalCreation.TriggerHistorical(ctx, refund.ID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp := buildRefundResponse(result.Refund)
|
||||
resp.SubmitterName = result.SubmitterName
|
||||
resp.ApprovalProvider = constants.IntegrationProviderWeCom
|
||||
resp.ApprovalStatus = &result.ApprovalStatus
|
||||
resp.ApprovalStatusName = constants.GetApprovalStatusName(result.ApprovalStatus)
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (s *Service) GetByID(ctx context.Context, id uint) (*dto.RefundResponse, error) {
|
||||
refund, err := s.refundStore.GetByID(ctx, id)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user