f
This commit is contained in:
@@ -10,8 +10,8 @@ import (
|
||||
"tyapi-server/internal/infrastructure/external/shumai"
|
||||
)
|
||||
|
||||
// 数脉 H5 活体结果查询中,以下 msg 表示检测不通过但属于正常业务响应,需返回 result=1 并扣费。
|
||||
var ivyzX5Q2BillableFailMsgs = map[string]struct{}{
|
||||
// 数脉 H5 活体结果查询中,以下 msg 属于正常业务响应,返回 result=2 且不扣费。
|
||||
var ivyzX5Q2NoBillFailMsgs = map[string]struct{}{
|
||||
"动作中检测不到人脸": {},
|
||||
"用户拒绝打开摄像头": {},
|
||||
"未检测到人脸": {},
|
||||
@@ -44,12 +44,12 @@ func ProcessIVYZX5Q2Request(ctx context.Context, params []byte, deps *processors
|
||||
respBytes, err := deps.ShumaiService.CallAPIForm(ctx, apiPath, reqFormData)
|
||||
if err != nil {
|
||||
if shumaiErr := shumai.GetShumaiError(err); shumaiErr != nil && shumaiErr.IsParamError() {
|
||||
if _, ok := ivyzX5Q2BillableFailMsgs[shumaiErr.Message]; ok {
|
||||
if _, ok := ivyzX5Q2NoBillFailMsgs[shumaiErr.Message]; ok {
|
||||
resp, marshalErr := buildIVYZX5Q2FailResponse(ctx, shumaiErr.Message)
|
||||
if marshalErr != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, marshalErr)
|
||||
}
|
||||
return resp, nil
|
||||
return nil, &processors.SuccessNoBillError{Response: resp}
|
||||
}
|
||||
}
|
||||
if errors.Is(err, shumai.ErrNotFound) {
|
||||
@@ -81,7 +81,7 @@ func ProcessIVYZX5Q2Request(ctx context.Context, params []byte, deps *processors
|
||||
|
||||
func buildIVYZX5Q2FailResponse(ctx context.Context, codeDesc string) ([]byte, error) {
|
||||
resp := ivyzX5Q2Resp{
|
||||
Result: 1,
|
||||
Result: 2,
|
||||
CodeDesc: codeDesc,
|
||||
}
|
||||
if orderNo, ok := ctx.Value("transaction_id").(string); ok && orderNo != "" {
|
||||
|
||||
Reference in New Issue
Block a user