新增部分接口合同授权码
This commit is contained in:
@@ -15,6 +15,11 @@ type CombServiceInterface interface {
|
||||
ProcessCombRequest(ctx context.Context, params []byte, deps *ProcessorDependencies, packageCode string) (*CombinedResult, error)
|
||||
}
|
||||
|
||||
// CallContext CallApi调用上下文,包含调用相关的数据
|
||||
type CallContext struct {
|
||||
ContractCode string // 合同编号
|
||||
}
|
||||
|
||||
// ProcessorDependencies 处理器依赖容器
|
||||
type ProcessorDependencies struct {
|
||||
WestDexService *westdex.WestDexService
|
||||
@@ -24,6 +29,7 @@ type ProcessorDependencies struct {
|
||||
Validator interfaces.RequestValidator
|
||||
CombService CombServiceInterface // Changed to interface to break import cycle
|
||||
Options *commands.ApiCallOptions // 添加Options支持
|
||||
CallContext *CallContext // 添加CallApi调用上下文
|
||||
}
|
||||
|
||||
// NewProcessorDependencies 创建处理器依赖容器
|
||||
@@ -43,6 +49,7 @@ func NewProcessorDependencies(
|
||||
Validator: validator,
|
||||
CombService: combService,
|
||||
Options: nil, // 初始化为nil,在调用时设置
|
||||
CallContext: nil, // 初始化为nil,在调用时设置
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +59,12 @@ func (deps *ProcessorDependencies) WithOptions(options *commands.ApiCallOptions)
|
||||
return deps
|
||||
}
|
||||
|
||||
// WithCallContext 设置CallContext的便捷方法
|
||||
func (deps *ProcessorDependencies) WithCallContext(callContext *CallContext) *ProcessorDependencies {
|
||||
deps.CallContext = callContext
|
||||
return deps
|
||||
}
|
||||
|
||||
// ProcessorFunc 处理器函数类型定义
|
||||
type ProcessorFunc func(ctx context.Context, params []byte, deps *ProcessorDependencies) ([]byte, error)
|
||||
|
||||
|
||||
@@ -33,13 +33,16 @@ func ProcessFLXG0V4BRequest(ctx context.Context, params []byte, deps *processors
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
encryptedAuthAuthorizeFileCode, err := deps.WestDexService.Encrypt(deps.CallContext.ContractCode)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
||||
}
|
||||
reqData := map[string]interface{}{
|
||||
"data": map[string]interface{}{
|
||||
"name": encryptedName,
|
||||
"idcard": encryptedIDCard,
|
||||
"auth_authorizeFileCode": encryptedAuthAuthorizeFileCode,
|
||||
"inquired_auth": paramsDto.AuthDate,
|
||||
// "auth_authorizeFileCode": paramsDto.AuthAuthorizeFileCode,
|
||||
},
|
||||
}
|
||||
respBytes, err := deps.WestDexService.CallAPI("G22SC01", reqData)
|
||||
|
||||
@@ -31,11 +31,15 @@ func ProcessQYGL8271Request(ctx context.Context, params []byte, deps *processors
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
encryptedAuthAuthorizeFileCode, err := deps.WestDexService.Encrypt(deps.CallContext.ContractCode)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
||||
}
|
||||
reqData := map[string]interface{}{
|
||||
"data": map[string]interface{}{
|
||||
"org_name": encryptedEntName,
|
||||
"uscc": encryptedEntCode,
|
||||
"auth_authorizeFileCode": encryptedAuthAuthorizeFileCode,
|
||||
"inquired_auth": paramsDto.AuthDate, // AuthDate 有 encrypt:"false" 标签,不加密
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user