19 lines
593 B
Go
19 lines
593 B
Go
package processors
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"errors"
|
|
)
|
|
|
|
// ValidateParamsAndCallTianyuan 校验入参后按天远产品编号转发
|
|
func ValidateParamsAndCallTianyuan(ctx context.Context, deps *ProcessorDependencies, tianyuanProductCode string, params []byte, dest interface{}) ([]byte, error) {
|
|
if err := json.Unmarshal(params, dest); err != nil {
|
|
return nil, errors.Join(ErrSystem, err)
|
|
}
|
|
if err := deps.Validator.ValidateStruct(dest); err != nil {
|
|
return nil, errors.Join(ErrInvalidParam, err)
|
|
}
|
|
return CallTianyuanByProduct(ctx, deps, tianyuanProductCode, params)
|
|
}
|