fix enterprise validate
This commit is contained in:
@@ -54,6 +54,9 @@ func ProcessQYGL45BDRequest(ctx context.Context, params []byte, deps *processors
|
||||
respBytes, err := deps.WestDexService.CallAPI("WEST00021", reqData)
|
||||
if err != nil {
|
||||
if errors.Is(err, westdex.ErrDatasource) {
|
||||
if respBytes != nil {
|
||||
return respBytes,nil
|
||||
}
|
||||
return nil, fmt.Errorf("%s: %w", processors.ErrDatasource, err)
|
||||
} else {
|
||||
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
||||
|
||||
@@ -58,12 +58,12 @@ func (s *EnterpriseInfoSubmitRecordService) ValidateWithWestdex(ctx context.Cont
|
||||
}
|
||||
|
||||
// 开发环境下跳过外部验证
|
||||
if s.appConfig.IsDevelopment() {
|
||||
s.logger.Info("开发环境:跳过企业信息外部验证",
|
||||
zap.String("company_name", info.CompanyName),
|
||||
zap.String("legal_person", info.LegalPersonName))
|
||||
return nil
|
||||
}
|
||||
// if s.appConfig.IsDevelopment() {
|
||||
// s.logger.Info("开发环境:跳过企业信息外部验证",
|
||||
// zap.String("company_name", info.CompanyName),
|
||||
// zap.String("legal_person", info.LegalPersonName))
|
||||
// return nil
|
||||
// }
|
||||
encryptedEntName, err := s.westdexService.Encrypt(info.CompanyName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s: %w", "企业四要素验证", err)
|
||||
@@ -92,14 +92,20 @@ func (s *EnterpriseInfoSubmitRecordService) ValidateWithWestdex(ctx context.Cont
|
||||
"idcard": encryptedIDCard,
|
||||
},
|
||||
}
|
||||
var respData []byte
|
||||
resp, err := s.westdexService.CallAPI("WEST00021", reqParams)
|
||||
if err != nil {
|
||||
return err
|
||||
if errors.Is(err, westdex.ErrDatasource) && resp != nil {
|
||||
respData = resp
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
}
|
||||
s.logger.Info("验证企业四要素响应", zap.Any("response", resp))
|
||||
resultState := gjson.GetBytes(resp, "result.state")
|
||||
respData = resp
|
||||
s.logger.Info("验证企业四要素响应", zap.Any("response", respData))
|
||||
resultState := gjson.GetBytes(respData, "result.state")
|
||||
if !resultState.Exists() {
|
||||
return fmt.Errorf("校验企业信息错误")
|
||||
return fmt.Errorf("企业信息不一致")
|
||||
}
|
||||
if resultState.Int() != 1 {
|
||||
return fmt.Errorf("企业信息不一致")
|
||||
|
||||
Reference in New Issue
Block a user